From c423aa432a7a54426c7405727f059fac1d1069e3 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 29 Jul 2021 17:57:17 +0300 Subject: [PATCH] [#730] node/config/morph: Add `disable_cache` Signed-off-by: Pavel Karpy --- cmd/neofs-node/config/morph/config.go | 6 ++++++ cmd/neofs-node/config/morph/config_test.go | 2 ++ config/example/README.md | 2 +- config/example/node.env | 1 + config/example/node.json | 1 + config/example/node.yaml | 1 + pkg/services/object/acl/eacl/types.go | 2 +- 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cmd/neofs-node/config/morph/config.go b/cmd/neofs-node/config/morph/config.go index b6da9eb71..a5e8d08e6 100644 --- a/cmd/neofs-node/config/morph/config.go +++ b/cmd/neofs-node/config/morph/config.go @@ -52,3 +52,9 @@ func DialTimeout(c *config.Config) time.Duration { 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") +} diff --git a/cmd/neofs-node/config/morph/config_test.go b/cmd/neofs-node/config/morph/config_test.go index babe4e072..3f9946be1 100644 --- a/cmd/neofs-node/config/morph/config_test.go +++ b/cmd/neofs-node/config/morph/config_test.go @@ -17,6 +17,7 @@ func TestMorphSection(t *testing.T) { require.Panics(t, func() { morphconfig.RPCEndpoint(empty) }) require.Panics(t, func() { morphconfig.NotificationEndpoint(empty) }) require.Equal(t, morphconfig.DialTimeoutDefault, morphconfig.DialTimeout(empty)) + require.Equal(t, false, morphconfig.DisableCache(empty)) }) const path = "../../../../config/example/node" @@ -37,6 +38,7 @@ func TestMorphSection(t *testing.T) { require.Equal(t, rpcs, morphconfig.RPCEndpoint(c)) require.Equal(t, wss, morphconfig.NotificationEndpoint(c)) require.Equal(t, 30*time.Second, morphconfig.DialTimeout(c)) + require.Equal(t, true, morphconfig.DisableCache(c)) } configtest.ForEachFileType(path, fileConfigTest) diff --git a/config/example/README.md b/config/example/README.md index eb3e494af..9c5c46267 100644 --- a/config/example/README.md +++ b/config/example/README.md @@ -4,7 +4,7 @@ Here are files in all supported formats and with all possible configuration valu of NeoFS applications. 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 diff --git a/config/example/node.env b/config/example/node.env index d3944d1e1..e6a6b1ad3 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -42,6 +42,7 @@ NEOFS_CONTRACTS_REPUTATION=441995f631c1da2b133462b71859494a5cd45e90 # Morph chain section 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_NOTIFICATION_ENDPOINT=wss://rpc1.morph.fs.neo.org:40341/ws wss://rpc2.morph.fs.neo.org:40341/ws diff --git a/config/example/node.json b/config/example/node.json index e8ef36586..4a16366ae 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -61,6 +61,7 @@ }, "morph": { "dial_timeout": "30s", + "disable_cache": true, "rpc_endpoint": [ "https://rpc1.morph.fs.neo.org:40341", "https://rpc2.morph.fs.neo.org:40341" diff --git a/config/example/node.yaml b/config/example/node.yaml index 31f2911ed..4e1ea9918 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -53,6 +53,7 @@ contracts: morph: dial_timeout: 30s + disable_cache: true rpc_endpoint: - https://rpc1.morph.fs.neo.org:40341 - https://rpc2.morph.fs.neo.org:40341 diff --git a/pkg/services/object/acl/eacl/types.go b/pkg/services/object/acl/eacl/types.go index e18730d4b..973c9ce2d 100644 --- a/pkg/services/object/acl/eacl/types.go +++ b/pkg/services/object/acl/eacl/types.go @@ -15,7 +15,7 @@ type Storage interface { // GetEACL must return exactly one non-nil value. // // 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) }