forked from TrueCloudLab/frostfs-node
Add Inner Ring code
This commit is contained in:
parent
dadfd90dcd
commit
b7b5079934
400 changed files with 11420 additions and 8690 deletions
40
pkg/innerring/processors/netmap/handlers.go
Normal file
40
pkg/innerring/processors/netmap/handlers.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package netmap
|
||||
|
||||
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"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func (np *Processor) handleNewEpochTick(ev event.Event) {
|
||||
_ = ev.(timerEvent.NewEpochTick) // todo: check panic in production
|
||||
np.log.Info("tick", zap.String("type", "epoch"))
|
||||
|
||||
// send event to the worker pool
|
||||
|
||||
err := np.pool.Submit(func() { np.processNewEpochTick() })
|
||||
if err != nil {
|
||||
// todo: move into controlled degradation stage
|
||||
np.log.Warn("netmap worker pool drained",
|
||||
zap.Int("capacity", np.pool.Cap()))
|
||||
}
|
||||
}
|
||||
|
||||
func (np *Processor) handleNewEpoch(ev event.Event) {
|
||||
epochEvent := ev.(netmapEvent.NewEpoch) // todo: check panic in production
|
||||
np.log.Info("notification",
|
||||
zap.String("type", "new epoch"),
|
||||
zap.Uint64("value", epochEvent.EpochNumber()))
|
||||
|
||||
// send event to the worker pool
|
||||
|
||||
err := np.pool.Submit(func() {
|
||||
np.processNewEpoch(epochEvent.EpochNumber())
|
||||
})
|
||||
if err != nil {
|
||||
// todo: move into controlled degradation stage
|
||||
np.log.Warn("netmap worker pool drained",
|
||||
zap.Int("capacity", np.pool.Cap()))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue