[#488] reputation/eigentrust/calculator: Implement calc wrapper

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-04-29 08:30:41 +03:00 committed by Alex Vanin
parent d3c1fc7dda
commit ea781664cf
14 changed files with 294 additions and 53 deletions

View file

@ -1,6 +1,8 @@
package eigentrust
import (
"context"
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
)
@ -25,7 +27,30 @@ func (x *EpochIteration) SetI(i uint32) {
x.i = i
}
func (x *EpochIteration) Increment() {
x.i++
}
type IterationTrust struct {
EpochIteration
reputation.Trust
}
// IterContext aggregates context and data required for
// iterations.
type IterContext struct {
context.Context
EpochIteration
}
func NewIterContext(ctx context.Context, epoch uint64, iter uint32) *IterContext {
ei := EpochIteration{}
ei.SetI(iter)
ei.SetEpoch(epoch)
return &IterContext{
Context: ctx,
EpochIteration: ei,
}
}