[#730] node/morph: Use disable_cache
config param
Do not init caches for eACL, containers and netmap if `disable_cache` config options is `true`, use direct RPC calls instead. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
c423aa432a
commit
e8665f6cef
10 changed files with 63 additions and 25 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
mainchainconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/mainchain"
|
||||
morphconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/morph"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||
|
@ -61,7 +62,18 @@ func initMorphComponents(c *cfg) {
|
|||
wrap, err := wrapper.NewFromMorph(c.cfgMorph.client, c.cfgNetmap.scriptHash, 0)
|
||||
fatalOnErr(err)
|
||||
|
||||
c.cfgObject.netMapStorage = newCachedNetmapStorage(c.cfgNetmap.state, wrap)
|
||||
var netmapSource netmap.Source
|
||||
|
||||
c.cfgMorph.disableCache = morphconfig.DisableCache(c.appCfg)
|
||||
|
||||
if c.cfgMorph.disableCache {
|
||||
netmapSource = wrap
|
||||
} else {
|
||||
// use RPC node as source of netmap (with caching)
|
||||
netmapSource = newCachedNetmapStorage(c.cfgNetmap.state, wrap)
|
||||
}
|
||||
|
||||
c.cfgObject.netMapSource = netmapSource
|
||||
c.cfgNetmap.wrapper = wrap
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue