[#446] cmd/neofs-node: Get inner ring list from RoleManagement contract

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-03-23 13:32:18 +03:00 committed by Alex Vanin
parent f9304fb2cb
commit 97fe50d452

View file

@ -15,6 +15,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/core/netmap"
objectCore "github.com/nspcc-dev/neofs-node/pkg/core/object" objectCore "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
morphClient "github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/network"
@ -138,6 +139,24 @@ func (i *delNetInfo) TombstoneLifetime() (uint64, error) {
return i.tsLifetime, nil return i.tsLifetime, nil
} }
type innerRingFetcher struct {
sidechain *morphClient.Client
}
func (n *innerRingFetcher) InnerRingKeys() ([][]byte, error) {
keys, err := n.sidechain.NeoFSAlphabetList()
if err != nil {
return nil, errors.Wrap(err, "can't get inner ring keys")
}
result := make([][]byte, 0, len(keys))
for i := range keys {
result = append(result, keys[i].Bytes())
}
return result, nil
}
func initObjectService(c *cfg) { func initObjectService(c *cfg) {
ls := c.cfgObject.cfgLocalStorage.localStorage ls := c.cfgObject.cfgLocalStorage.localStorage
keyStorage := util.NewKeyStorage(c.key, c.privateTokenStore) keyStorage := util.NewKeyStorage(c.key, c.privateTokenStore)
@ -159,6 +178,10 @@ func initObjectService(c *cfg) {
basicConstructor: clientCache, basicConstructor: clientCache,
} }
irFetcher := &innerRingFetcher{
sidechain: c.cfgMorph.client,
}
objRemover := &localObjectRemover{ objRemover := &localObjectRemover{
storage: ls, storage: ls,
log: c.log, log: c.log,
@ -338,7 +361,7 @@ func initObjectService(c *cfg) {
acl.WithSenderClassifier( acl.WithSenderClassifier(
acl.NewSenderClassifier( acl.NewSenderClassifier(
c.log, c.log,
c.cfgNetmap.wrapper, irFetcher,
c.cfgNetmap.wrapper, c.cfgNetmap.wrapper,
), ),
), ),