forked from TrueCloudLab/frostfs-node
Resolved containedctx linters. Renamed context structs and interfaces to more understandble names. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
53 lines
1 KiB
Go
53 lines
1 KiB
Go
package common
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/reputation"
|
|
)
|
|
|
|
type EpochProvider struct {
|
|
E uint64
|
|
}
|
|
|
|
func (ep *EpochProvider) Epoch() uint64 {
|
|
return ep.E
|
|
}
|
|
|
|
type NopReputationWriter struct{}
|
|
|
|
func (NopReputationWriter) Write(context.Context, reputation.Trust) error {
|
|
return nil
|
|
}
|
|
|
|
func (NopReputationWriter) Close(context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
// OnlyKeyRemoteServerInfo is an implementation of reputation.ServerInfo
|
|
// interface but with only public key data.
|
|
type OnlyKeyRemoteServerInfo struct {
|
|
Key []byte
|
|
}
|
|
|
|
func (i *OnlyKeyRemoteServerInfo) PublicKey() []byte {
|
|
return i.Key
|
|
}
|
|
|
|
func (*OnlyKeyRemoteServerInfo) IterateAddresses(func(string) bool) {
|
|
}
|
|
|
|
func (*OnlyKeyRemoteServerInfo) NumberOfAddresses() int {
|
|
return 0
|
|
}
|
|
|
|
func (*OnlyKeyRemoteServerInfo) ExternalAddresses() []string {
|
|
return nil
|
|
}
|
|
|
|
const invalidPrmValFmt = "invalid parameter %s (%T):%v"
|
|
|
|
func PanicOnPrmValue(n string, v any) {
|
|
panic(fmt.Sprintf(invalidPrmValFmt, n, v, v))
|
|
}
|