[#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
46
cmd/neofs-node/reputation/common/util.go
Normal file
46
cmd/neofs-node/reputation/common/util.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
)
|
||||
|
||||
type EpochContext struct {
|
||||
context.Context
|
||||
E uint64
|
||||
}
|
||||
|
||||
func (ctx *EpochContext) Epoch() uint64 {
|
||||
return ctx.E
|
||||
}
|
||||
|
||||
type NopReputationWriter struct{}
|
||||
|
||||
func (NopReputationWriter) Write(common.Context, reputation.Trust) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (NopReputationWriter) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type OnlyKeyRemoteServerInfo struct {
|
||||
Key []byte
|
||||
}
|
||||
|
||||
func (i *OnlyKeyRemoteServerInfo) PublicKey() []byte {
|
||||
return i.Key
|
||||
}
|
||||
|
||||
func (*OnlyKeyRemoteServerInfo) Address() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
||||
|
||||
func PanicOnPrmValue(n string, v interface{}) {
|
||||
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue