2021-04-22 14:56:25 +00:00
|
|
|
package routes
|
2021-04-03 06:11:12 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
2021-04-17 19:17:30 +00:00
|
|
|
reputationroute "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common/router"
|
2021-04-03 06:11:12 +00:00
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
2021-04-22 14:56:25 +00:00
|
|
|
// NextStage builds Manager list for trusted node and returns it directly.
|
2021-04-03 06:11:12 +00:00
|
|
|
//
|
|
|
|
// If passed route has more than one point, then endpoint of the route is reached.
|
2021-04-17 16:15:38 +00:00
|
|
|
func (b *Builder) NextStage(epoch uint64, t reputation.Trust, passed []reputationroute.ServerInfo) ([]reputationroute.ServerInfo, error) {
|
2021-04-03 06:11:12 +00:00
|
|
|
if len(passed) > 1 {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2021-04-22 14:56:25 +00:00
|
|
|
route, err := b.managerBuilder.BuildManagers(epoch, t.Peer())
|
2021-04-03 06:11:12 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, errors.Wrapf(err, "could not build managers for epoch: %d", epoch)
|
|
|
|
}
|
|
|
|
|
|
|
|
return route, nil
|
|
|
|
}
|