[#479] cmd/neofs-node: Add eigen trust block timer

Eigen trust block timer ticks to start new round of
eigen trust calculations. Every epoch this timer
recalculates duration and starts again.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-04-15 17:57:29 +03:00 committed by Alex Vanin
parent 376bb293b4
commit 66ddff3498
5 changed files with 120 additions and 0 deletions

View file

@ -337,6 +337,26 @@ func initReputationService(c *cfg) {
),
),
)
// initialize eigen trust block timer
durationMeter := NewEigenTrustDuration(c.cfgNetmap.wrapper)
newEigenTrustIterTimer(c, durationMeter, func() {
c.log.Debug("todo: start next EigenTrust iteration round")
})
addNewEpochAsyncNotificationHandler(
c,
func(e event.Event) {
durationMeter.Update() // recalculate duration of one iteration round
err := c.cfgMorph.eigenTrustTimer.Reset() // start iteration rounds again
if err != nil {
c.log.Warn("can't reset block timer to start eigen trust calculations again",
zap.String("error", err.Error()))
}
},
)
}
type reputationServer struct {