forked from TrueCloudLab/frostfs-node
[#488] reputation/eigentrust/calculator: Implement calc wrapper
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d3c1fc7dda
commit
ea781664cf
14 changed files with 294 additions and 53 deletions
27
cmd/neofs-node/reputation/intermediate/calculator.go
Normal file
27
cmd/neofs-node/reputation/intermediate/calculator.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package intermediate
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust"
|
||||
eigencalc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/calculator"
|
||||
eigentrustctrl "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/controller"
|
||||
)
|
||||
|
||||
// DaughtersTrustCalculator wraps EigenTrust calculator and implements
|
||||
// eigentrust/calculator's DaughtersTrustCalculator interface.
|
||||
type DaughtersTrustCalculator struct {
|
||||
Calculator *eigencalc.Calculator
|
||||
}
|
||||
|
||||
// Calculate converts and passes values to wrapped calculator.
|
||||
func (c *DaughtersTrustCalculator) Calculate(ctx eigentrustctrl.IterationContext) {
|
||||
calcPrm := eigencalc.CalculatePrm{}
|
||||
epochIteration := eigentrust.EpochIteration{}
|
||||
|
||||
epochIteration.SetEpoch(ctx.Epoch())
|
||||
epochIteration.SetI(ctx.I())
|
||||
|
||||
calcPrm.SetLast(ctx.Last())
|
||||
calcPrm.SetEpochIteration(epochIteration)
|
||||
|
||||
c.Calculator.Calculate(calcPrm)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue