forked from TrueCloudLab/frostfs-node
[#488] reputation/managers: Implement route builders
Add implementation of Builder interface for intermediate trusts. Move all code associated with managers to `common` directory in `cmd` and `pkg/services/reputation` Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
6ffc109a75
commit
49d477f466
9 changed files with 106 additions and 31 deletions
23
pkg/services/reputation/eigentrust/routes/calls.go
Normal file
23
pkg/services/reputation/eigentrust/routes/calls.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package routes
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
reputationroute "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common/router"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// NextStage builds Manager list for trusted node and returns it directly.
|
||||
//
|
||||
// If passed route has more than one point, then endpoint of the route is reached.
|
||||
func (b *Builder) NextStage(epoch uint64, t reputation.Trust, passed []reputationroute.ServerInfo) ([]reputationroute.ServerInfo, error) {
|
||||
if len(passed) > 1 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
route, err := b.managerBuilder.BuildManagers(epoch, t.Peer())
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not build managers for epoch: %d", epoch)
|
||||
}
|
||||
|
||||
return route, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue