forked from TrueCloudLab/frostfs-node
[#212] reputationsvc: Resolve linters and rename
Resolved containedctx linters. Renamed context structs and interfaces to more understandble names. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
469e8a6e59
commit
7ebbfa3358
24 changed files with 203 additions and 238 deletions
|
@ -1,6 +1,8 @@
|
|||
package eigentrustctrl
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/reputation/eigentrust"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -22,7 +24,7 @@ func (x iterContext) Last() bool {
|
|||
}
|
||||
|
||||
// Continue moves the global reputation calculator to the next iteration.
|
||||
func (c *Controller) Continue(prm ContinuePrm) {
|
||||
func (c *Controller) Continue(ctx context.Context, prm ContinuePrm) {
|
||||
c.mtx.Lock()
|
||||
|
||||
{
|
||||
|
@ -46,7 +48,7 @@ func (c *Controller) Continue(prm ContinuePrm) {
|
|||
iterCtx.last = iterCtx.I() == iterCtx.iterationNumber-1
|
||||
|
||||
err := c.prm.WorkerPool.Submit(func() {
|
||||
c.prm.DaughtersTrustCalculator.Calculate(iterCtx)
|
||||
c.prm.DaughtersTrustCalculator.Calculate(ctx, iterCtx)
|
||||
|
||||
// iteration++
|
||||
iterCtx.Increment()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package eigentrustctrl
|
||||
|
||||
import "context"
|
||||
|
||||
// IterationContext is a context of the i-th
|
||||
// stage of iterative EigenTrust algorithm.
|
||||
type IterationContext interface {
|
||||
|
@ -25,7 +27,7 @@ type DaughtersTrustCalculator interface {
|
|||
// http://ilpubs.stanford.edu:8090/562/1/2002-56.pdf Ch.5.1.
|
||||
//
|
||||
// Execution should be interrupted if ctx.Last().
|
||||
Calculate(ctx IterationContext)
|
||||
Calculate(ctx context.Context, iter IterationContext)
|
||||
}
|
||||
|
||||
// IterationsProvider must provide information about numbers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue