forked from TrueCloudLab/frostfs-node
[#1278] neofs-node: Use global cached netmap source in services
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
7ed84d1755
commit
be6ae3c066
6 changed files with 13 additions and 14 deletions
|
@ -115,6 +115,8 @@ type cfg struct {
|
||||||
clientCache *cache.ClientCache
|
clientCache *cache.ClientCache
|
||||||
|
|
||||||
persistate *state.PersistentStorage
|
persistate *state.PersistentStorage
|
||||||
|
|
||||||
|
netMapSource netmapCore.Source
|
||||||
}
|
}
|
||||||
|
|
||||||
type cfgGRPC struct {
|
type cfgGRPC struct {
|
||||||
|
@ -173,8 +175,6 @@ type cfgNodeInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type cfgObject struct {
|
type cfgObject struct {
|
||||||
netMapSource netmapCore.Source
|
|
||||||
|
|
||||||
cnrSource container.Source
|
cnrSource container.Source
|
||||||
|
|
||||||
eaclSource eacl.Source
|
eaclSource eacl.Source
|
||||||
|
|
|
@ -105,7 +105,7 @@ func initContainerService(c *cfg) {
|
||||||
|
|
||||||
loadPlacementBuilder := &loadPlacementBuilder{
|
loadPlacementBuilder := &loadPlacementBuilder{
|
||||||
log: c.log,
|
log: c.log,
|
||||||
nmSrc: c.cfgNetmap.wrapper,
|
nmSrc: c.netMapSource,
|
||||||
cnrSrc: cnrSrc,
|
cnrSrc: cnrSrc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ func initControlService(c *cfg) {
|
||||||
controlSvc.WithKey(&c.key.PrivateKey),
|
controlSvc.WithKey(&c.key.PrivateKey),
|
||||||
controlSvc.WithAuthorizedKeys(rawPubs),
|
controlSvc.WithAuthorizedKeys(rawPubs),
|
||||||
controlSvc.WithHealthChecker(c),
|
controlSvc.WithHealthChecker(c),
|
||||||
controlSvc.WithNetMapSource(c.cfgNetmap.wrapper),
|
controlSvc.WithNetMapSource(c.netMapSource),
|
||||||
controlSvc.WithNodeState(c),
|
controlSvc.WithNodeState(c),
|
||||||
controlSvc.WithDeletedObjectHandler(func(addrList []*addressSDK.Address) error {
|
controlSvc.WithDeletedObjectHandler(func(addrList []*addressSDK.Address) error {
|
||||||
prm := new(engine.DeletePrm).WithAddresses(addrList...)
|
prm := new(engine.DeletePrm).WithAddresses(addrList...)
|
||||||
|
|
|
@ -102,7 +102,7 @@ func initMorphComponents(c *cfg) {
|
||||||
netmapSource = newCachedNetmapStorage(c.cfgNetmap.state, wrap)
|
netmapSource = newCachedNetmapStorage(c.cfgNetmap.state, wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.cfgObject.netMapSource = netmapSource
|
c.netMapSource = netmapSource
|
||||||
c.cfgNetmap.wrapper = wrap
|
c.cfgNetmap.wrapper = wrap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ func initObjectService(c *cfg) {
|
||||||
|
|
||||||
clientConstructor := &reputationClientConstructor{
|
clientConstructor := &reputationClientConstructor{
|
||||||
log: c.log,
|
log: c.log,
|
||||||
nmSrc: c.cfgObject.netMapSource,
|
nmSrc: c.netMapSource,
|
||||||
netState: c.cfgNetmap.state,
|
netState: c.cfgNetmap.state,
|
||||||
trustStorage: c.cfgReputation.localTrustStorage,
|
trustStorage: c.cfgReputation.localTrustStorage,
|
||||||
basicConstructor: c.clientCache,
|
basicConstructor: c.clientCache,
|
||||||
|
@ -224,7 +224,7 @@ func initObjectService(c *cfg) {
|
||||||
policer.WithLocalStorage(ls),
|
policer.WithLocalStorage(ls),
|
||||||
policer.WithContainerSource(c.cfgObject.cnrSource),
|
policer.WithContainerSource(c.cfgObject.cnrSource),
|
||||||
policer.WithPlacementBuilder(
|
policer.WithPlacementBuilder(
|
||||||
placement.NewNetworkMapSourceBuilder(c.cfgObject.netMapSource),
|
placement.NewNetworkMapSourceBuilder(c.netMapSource),
|
||||||
),
|
),
|
||||||
policer.WithRemoteHeader(
|
policer.WithRemoteHeader(
|
||||||
headsvc.NewRemoteHeader(keyStorage, clientConstructor),
|
headsvc.NewRemoteHeader(keyStorage, clientConstructor),
|
||||||
|
@ -247,7 +247,7 @@ func initObjectService(c *cfg) {
|
||||||
policer.WithNodeLoader(c),
|
policer.WithNodeLoader(c),
|
||||||
)
|
)
|
||||||
|
|
||||||
traverseGen := util.NewTraverserGenerator(c.cfgObject.netMapSource, c.cfgObject.cnrSource, c)
|
traverseGen := util.NewTraverserGenerator(c.netMapSource, c.cfgObject.cnrSource, c)
|
||||||
|
|
||||||
c.workers = append(c.workers, pol)
|
c.workers = append(c.workers, pol)
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ func initObjectService(c *cfg) {
|
||||||
putsvc.WithMaxSizeSource(c),
|
putsvc.WithMaxSizeSource(c),
|
||||||
putsvc.WithObjectStorage(os),
|
putsvc.WithObjectStorage(os),
|
||||||
putsvc.WithContainerSource(c.cfgObject.cnrSource),
|
putsvc.WithContainerSource(c.cfgObject.cnrSource),
|
||||||
putsvc.WithNetworkMapSource(c.cfgObject.netMapSource),
|
putsvc.WithNetworkMapSource(c.netMapSource),
|
||||||
putsvc.WithNetmapKeys(c),
|
putsvc.WithNetmapKeys(c),
|
||||||
putsvc.WithFormatValidatorOpts(
|
putsvc.WithFormatValidatorOpts(
|
||||||
objectCore.WithDeleteHandler(objInhumer),
|
objectCore.WithDeleteHandler(objInhumer),
|
||||||
|
@ -296,7 +296,7 @@ func initObjectService(c *cfg) {
|
||||||
placement.WithoutSuccessTracking(),
|
placement.WithoutSuccessTracking(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
searchsvc.WithNetMapSource(c.cfgNetmap.wrapper),
|
searchsvc.WithNetMapSource(c.netMapSource),
|
||||||
searchsvc.WithKeyStorage(keyStorage),
|
searchsvc.WithKeyStorage(keyStorage),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ func initObjectService(c *cfg) {
|
||||||
placement.SuccessAfter(1),
|
placement.SuccessAfter(1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
getsvc.WithNetMapSource(c.cfgNetmap.wrapper),
|
getsvc.WithNetMapSource(c.netMapSource),
|
||||||
getsvc.WithKeyStorage(keyStorage),
|
getsvc.WithKeyStorage(keyStorage),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ func initObjectService(c *cfg) {
|
||||||
aclSvc := v2.New(
|
aclSvc := v2.New(
|
||||||
v2.WithLogger(c.log),
|
v2.WithLogger(c.log),
|
||||||
v2.WithIRFetcher(irFetcher),
|
v2.WithIRFetcher(irFetcher),
|
||||||
v2.WithNetmapSource(c.cfgNetmap.wrapper),
|
v2.WithNetmapSource(c.netMapSource),
|
||||||
v2.WithContainerSource(
|
v2.WithContainerSource(
|
||||||
c.cfgObject.cnrSource,
|
c.cfgObject.cnrSource,
|
||||||
),
|
),
|
||||||
|
|
|
@ -38,8 +38,7 @@ func initReputationService(c *cfg) {
|
||||||
|
|
||||||
localKey := c.key.PublicKey().Bytes()
|
localKey := c.key.PublicKey().Bytes()
|
||||||
|
|
||||||
// consider sharing this between application components
|
nmSrc := c.netMapSource
|
||||||
nmSrc := newCachedNetmapStorage(c.cfgNetmap.state, c.cfgNetmap.wrapper)
|
|
||||||
|
|
||||||
// storing calculated trusts as a daughter
|
// storing calculated trusts as a daughter
|
||||||
c.cfgReputation.localTrustStorage = truststorage.New(
|
c.cfgReputation.localTrustStorage = truststorage.New(
|
||||||
|
|
Loading…
Reference in a new issue