diff --git a/pkg/services/reputation/eigentrust/controller/calls.go b/pkg/services/reputation/eigentrust/controller/calls.go index 28228706..faf953ae 100644 --- a/pkg/services/reputation/eigentrust/controller/calls.go +++ b/pkg/services/reputation/eigentrust/controller/calls.go @@ -1,8 +1,6 @@ package eigentrustctrl import ( - "context" - "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/reputation/eigentrust" "go.uber.org/zap" ) @@ -12,10 +10,7 @@ type ContinuePrm struct { Epoch uint64 } -// nolint: containedctx type iterContext struct { - context.Context - eigentrust.EpochIteration iterationNumber uint32 @@ -26,12 +21,6 @@ func (x iterContext) Last() bool { return x.last } -type iterContextCancel struct { - iterContext - - cancel context.CancelFunc -} - // Continue moves the global reputation calculator to the next iteration. func (c *Controller) Continue(prm ContinuePrm) { c.mtx.Lock() @@ -39,10 +28,9 @@ func (c *Controller) Continue(prm ContinuePrm) { { iterCtx, ok := c.mCtx[prm.Epoch] if !ok { - iterCtx = new(iterContextCancel) + iterCtx = new(iterContext) c.mCtx[prm.Epoch] = iterCtx - iterCtx.Context, iterCtx.cancel = context.WithCancel(context.Background()) iterCtx.EpochIteration.SetEpoch(prm.Epoch) iterations, err := c.prm.IterationsProvider.EigenTrustIterations() @@ -53,14 +41,12 @@ func (c *Controller) Continue(prm ContinuePrm) { } else { iterCtx.iterationNumber = uint32(iterations) } - } else { - iterCtx.cancel() } iterCtx.last = iterCtx.I() == iterCtx.iterationNumber-1 err := c.prm.WorkerPool.Submit(func() { - c.prm.DaughtersTrustCalculator.Calculate(iterCtx.iterContext) + c.prm.DaughtersTrustCalculator.Calculate(iterCtx) // iteration++ iterCtx.Increment() diff --git a/pkg/services/reputation/eigentrust/controller/controller.go b/pkg/services/reputation/eigentrust/controller/controller.go index fe9150bc..a6d0d4a8 100644 --- a/pkg/services/reputation/eigentrust/controller/controller.go +++ b/pkg/services/reputation/eigentrust/controller/controller.go @@ -47,7 +47,7 @@ type Controller struct { opts *options mtx sync.Mutex - mCtx map[uint64]*iterContextCancel + mCtx map[uint64]*iterContext } const invalidPrmValFmt = "invalid parameter %s (%T):%v" @@ -81,6 +81,6 @@ func New(prm Prm, opts ...Option) *Controller { return &Controller{ prm: prm, opts: o, - mCtx: make(map[uint64]*iterContextCancel), + mCtx: make(map[uint64]*iterContext), } } diff --git a/pkg/services/reputation/eigentrust/controller/deps.go b/pkg/services/reputation/eigentrust/controller/deps.go index 8c475265..2aeafb61 100644 --- a/pkg/services/reputation/eigentrust/controller/deps.go +++ b/pkg/services/reputation/eigentrust/controller/deps.go @@ -1,14 +1,8 @@ package eigentrustctrl -import ( - "context" -) - // IterationContext is a context of the i-th // stage of iterative EigenTrust algorithm. type IterationContext interface { - context.Context - // Must return epoch number to select the values // for global trust calculation. Epoch() uint64