From b9615707667d0f0474395cbc6cd2f822e056859f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 17 Feb 2021 15:19:54 +0300 Subject: [PATCH] [#378] cmd/node: Subscribe shards on new epoch events Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 6c8d4b18..8468aff3 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -28,6 +28,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" nmwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" + netmap2 "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap" "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/control" tokenStorage "github.com/nspcc-dev/neofs-node/pkg/services/session/storage" @@ -611,6 +612,15 @@ func initShardOptions(c *cfg) { return pool }), + shard.WithGCEventChannelInitializer(func() <-chan shard.Event { + ch := make(chan shard.Event) + + addNewEpochNotificationHandler(c, func(ev event.Event) { + ch <- shard.EventNewEpoch(ev.(netmap2.NewEpoch).EpochNumber()) + }) + + return ch + }), }) c.log.Info("storage shard options",