diff --git a/cmd/neofs-node/reputation.go b/cmd/neofs-node/reputation.go index 7a4dc7c0..b4e02ebe 100644 --- a/cmd/neofs-node/reputation.go +++ b/cmd/neofs-node/reputation.go @@ -68,11 +68,11 @@ func initReputationService(c *cfg) { LocalKey: localKey, } - managerBuilder := common.NewManagerBuilder( - common.ManagersPrm{ + managerBuilder := reputationcommon.NewManagerBuilder( + reputationcommon.ManagersPrm{ NetMapSource: nmSrc, }, - common.WithLogger(c.log), + reputationcommon.WithLogger(c.log), ) localRouteBuilder := localroutes.New( diff --git a/cmd/neofs-node/reputation/common/managers.go b/pkg/services/reputation/common/managers.go similarity index 88% rename from cmd/neofs-node/reputation/common/managers.go rename to pkg/services/reputation/common/managers.go index e9260a41..9cddc809 100644 --- a/cmd/neofs-node/reputation/common/managers.go +++ b/pkg/services/reputation/common/managers.go @@ -2,12 +2,12 @@ package common import ( "bytes" + "fmt" "github.com/nspcc-dev/hrw" apiNetmap "github.com/nspcc-dev/neofs-api-go/pkg/netmap" netmapcore "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/services/reputation" - "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "go.uber.org/zap" ) @@ -36,10 +36,10 @@ type ManagersPrm struct { // // The created managerBuilder does not require additional // initialization and is completely ready for work. -func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) common.ManagerBuilder { +func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) ManagerBuilder { switch { case prm.NetMapSource == nil: - PanicOnPrmValue("NetMapSource", prm.NetMapSource) + panic(fmt.Sprintf("invalid NetMapSource (%T):%v", prm.NetMapSource, prm.NetMapSource)) } o := defaultMngOpts() @@ -57,7 +57,7 @@ func NewManagerBuilder(prm ManagersPrm, opts ...MngOption) common.ManagerBuilder // BuildManagers sorts nodes in NetMap with HRW algorithms and // takes the next node after the current one as the only manager. -func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]common.ServerInfo, error) { +func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]ServerInfo, error) { nm, err := mb.nmSrc.GetNetMapByEpoch(epoch) if err != nil { return nil, err @@ -78,7 +78,7 @@ func (mb *managerBuilder) BuildManagers(epoch uint64, p reputation.PeerID) ([]co managerIndex = 0 } - return []common.ServerInfo{nodes[managerIndex]}, nil + return []ServerInfo{nodes[managerIndex]}, nil } }