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
|
@ -1,14 +0,0 @@
|
|||
package managers
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
reputationrouter "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common/router"
|
||||
)
|
||||
|
||||
// ManagerBuilder defines an interface for providing a list
|
||||
// of Managers for specific epoch. Implementation depends on trust value.
|
||||
type ManagerBuilder interface {
|
||||
// BuildManagers must compose list of managers. It depends on
|
||||
// particular epoch and PeerID of the current route point.
|
||||
BuildManagers(epoch uint64, p reputation.PeerID) ([]reputationrouter.ServerInfo, error)
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
package managers
|
||||
package routes
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
)
|
||||
|
||||
// Prm groups the required parameters of the Builder's constructor.
|
||||
//
|
||||
|
@ -11,7 +15,7 @@ type Prm struct {
|
|||
// Manager builder for current node.
|
||||
//
|
||||
// Must not be nil.
|
||||
ManagerBuilder ManagerBuilder
|
||||
ManagerBuilder common.ManagerBuilder
|
||||
}
|
||||
|
||||
// Builder represents component that routes node to its managers.
|
||||
|
@ -21,7 +25,7 @@ type Prm struct {
|
|||
// and optional components. After successful creation,
|
||||
// the Builder is immediately ready to work through API.
|
||||
type Builder struct {
|
||||
managerBuilder ManagerBuilder
|
||||
managerBuilder common.ManagerBuilder
|
||||
}
|
||||
|
||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
|
@ -1,4 +1,4 @@
|
|||
package managers
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// NextStage builds Manager list for node and returns it directly.
|
||||
// NextStage builds Manager list for trusting 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) {
|
Loading…
Add table
Add a link
Reference in a new issue