[#730] node/config/morph: Add disable_cache

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-07-29 17:57:17 +03:00 committed by Alex Vanin
parent cb842096d4
commit c423aa432a
7 changed files with 13 additions and 2 deletions

View file

@ -52,3 +52,9 @@ func DialTimeout(c *config.Config) time.Duration {
return DialTimeoutDefault return DialTimeoutDefault
} }
// DisableCache returns value of "disable_cache" config parameter
// from "morph" section.
func DisableCache(c *config.Config) bool {
return config.BoolSafe(c.Sub(subsection), "disable_cache")
}

View file

@ -17,6 +17,7 @@ func TestMorphSection(t *testing.T) {
require.Panics(t, func() { morphconfig.RPCEndpoint(empty) }) require.Panics(t, func() { morphconfig.RPCEndpoint(empty) })
require.Panics(t, func() { morphconfig.NotificationEndpoint(empty) }) require.Panics(t, func() { morphconfig.NotificationEndpoint(empty) })
require.Equal(t, morphconfig.DialTimeoutDefault, morphconfig.DialTimeout(empty)) require.Equal(t, morphconfig.DialTimeoutDefault, morphconfig.DialTimeout(empty))
require.Equal(t, false, morphconfig.DisableCache(empty))
}) })
const path = "../../../../config/example/node" const path = "../../../../config/example/node"
@ -37,6 +38,7 @@ func TestMorphSection(t *testing.T) {
require.Equal(t, rpcs, morphconfig.RPCEndpoint(c)) require.Equal(t, rpcs, morphconfig.RPCEndpoint(c))
require.Equal(t, wss, morphconfig.NotificationEndpoint(c)) require.Equal(t, wss, morphconfig.NotificationEndpoint(c))
require.Equal(t, 30*time.Second, morphconfig.DialTimeout(c)) require.Equal(t, 30*time.Second, morphconfig.DialTimeout(c))
require.Equal(t, true, morphconfig.DisableCache(c))
} }
configtest.ForEachFileType(path, fileConfigTest) configtest.ForEachFileType(path, fileConfigTest)

View file

@ -4,7 +4,7 @@ Here are files in all supported formats and with all possible configuration valu
of NeoFS applications. of NeoFS applications.
All parameters are correct, however, they are for informational purposes only. All parameters are correct, however, they are for informational purposes only.
It is not recommended to transfer these configs for real application launches. It is not recommended transferring these configs for real application launches.
## Config files ## Config files

View file

@ -42,6 +42,7 @@ NEOFS_CONTRACTS_REPUTATION=441995f631c1da2b133462b71859494a5cd45e90
# Morph chain section # Morph chain section
NEOFS_MORPH_DIAL_TIMEOUT=30s NEOFS_MORPH_DIAL_TIMEOUT=30s
NEOFS_MORPH_DISABLE_CACHE=true
NEOFS_MORPH_RPC_ENDPOINT=https://rpc1.morph.fs.neo.org:40341 https://rpc2.morph.fs.neo.org:40341 NEOFS_MORPH_RPC_ENDPOINT=https://rpc1.morph.fs.neo.org:40341 https://rpc2.morph.fs.neo.org:40341
NEOFS_MORPH_NOTIFICATION_ENDPOINT=wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws NEOFS_MORPH_NOTIFICATION_ENDPOINT=wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws

View file

@ -61,6 +61,7 @@
}, },
"morph": { "morph": {
"dial_timeout": "30s", "dial_timeout": "30s",
"disable_cache": true,
"rpc_endpoint": [ "rpc_endpoint": [
"https://rpc1.morph.fs.neo.org:40341", "https://rpc1.morph.fs.neo.org:40341",
"https://rpc2.morph.fs.neo.org:40341" "https://rpc2.morph.fs.neo.org:40341"

View file

@ -53,6 +53,7 @@ contracts:
morph: morph:
dial_timeout: 30s dial_timeout: 30s
disable_cache: true
rpc_endpoint: rpc_endpoint:
- https://rpc1.morph.fs.neo.org:40341 - https://rpc1.morph.fs.neo.org:40341
- https://rpc2.morph.fs.neo.org:40341 - https://rpc2.morph.fs.neo.org:40341

View file

@ -15,7 +15,7 @@ type Storage interface {
// GetEACL must return exactly one non-nil value. // GetEACL must return exactly one non-nil value.
// //
// Must return pkg/core/container.ErrEACLNotFound if requested // Must return pkg/core/container.ErrEACLNotFound if requested
// eACL table is is not in storage. // eACL table is not in storage.
GetEACL(*cid.ID) (*eacl.Table, error) GetEACL(*cid.ID) (*eacl.Table, error)
} }