[#987] ir: Add RemoveNode parser and handler

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-11-26 17:16:03 +03:00 committed by LeL
parent 81dc17718e
commit 214c2bd0cb
4 changed files with 115 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import (
timerEvent "github.com/nspcc-dev/neofs-node/pkg/innerring/timers"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
"github.com/nspcc-dev/neofs-node/pkg/morph/event/subnet"
"go.uber.org/zap"
)
@ -99,3 +100,22 @@ func (np *Processor) handleCleanupTick(ev event.Event) {
zap.Int("capacity", np.pool.Cap()))
}
}
func (np *Processor) handleRemoveNode(ev event.Event) {
removeNode := ev.(subnet.RemoveNode)
np.log.Info("notification",
zap.String("type", "remove node from subnet"),
zap.String("subnetID", hex.EncodeToString(removeNode.SubnetworkID())),
zap.String("key", hex.EncodeToString(removeNode.Node())),
)
err := np.pool.Submit(func() {
np.processRemoveSubnetNode(removeNode)
})
if err != nil {
// there system can be moved into controlled degradation stage
np.log.Warn("netmap worker pool drained",
zap.Int("capacity", np.pool.Cap()))
}
}