forked from TrueCloudLab/frostfs-node
[#1320] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
parent
d99800ee93
commit
cc7a723d77
182 changed files with 802 additions and 802 deletions
|
@ -15,16 +15,16 @@ type clientCache interface {
|
|||
Get(client.NodeInfo) (client.Client, error)
|
||||
}
|
||||
|
||||
// clientKeyRemoteProvider must provide remote writer and take into account
|
||||
// that requests must be sent via passed api client and must be signed with
|
||||
// passed private key.
|
||||
// clientKeyRemoteProvider must provide a remote writer and take into account
|
||||
// that requests must be sent via the passed api client and must be signed with
|
||||
// the passed private key.
|
||||
type clientKeyRemoteProvider interface {
|
||||
WithClient(client.Client) reputationcommon.WriterProvider
|
||||
}
|
||||
|
||||
// remoteTrustProvider is implementation of reputation RemoteWriterProvider interface.
|
||||
// It caches clients, checks if it is the end of the route and checks either current
|
||||
// node is remote target or not.
|
||||
// remoteTrustProvider is an implementation of reputation RemoteWriterProvider interface.
|
||||
// It caches clients, checks if it is the end of the route and checks either the current
|
||||
// node is a remote target or not.
|
||||
//
|
||||
// remoteTrustProvider requires to be provided with clientKeyRemoteProvider.
|
||||
type remoteTrustProvider struct {
|
||||
|
|
|
@ -27,7 +27,7 @@ func (NopReputationWriter) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// OnlyKeyRemoteServerInfo if implementation of reputation.ServerInfo
|
||||
// OnlyKeyRemoteServerInfo is an implementation of reputation.ServerInfo
|
||||
// interface but with only public key data.
|
||||
type OnlyKeyRemoteServerInfo struct {
|
||||
Key []byte
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
eigentrustctrl "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/controller"
|
||||
)
|
||||
|
||||
// InitialTrustSource is implementation of the
|
||||
// InitialTrustSource is an implementation of the
|
||||
// reputation/eigentrust/calculator's InitialTrustSource interface.
|
||||
type InitialTrustSource struct {
|
||||
NetMap netmap.Source
|
||||
|
@ -19,7 +19,7 @@ type InitialTrustSource struct {
|
|||
|
||||
var ErrEmptyNetMap = errors.New("empty NepMap")
|
||||
|
||||
// InitialTrust returns `initialTrust` as initial trust value.
|
||||
// InitialTrust returns `initialTrust` as an initial trust value.
|
||||
func (i InitialTrustSource) InitialTrust(reputation.PeerID) (reputation.TrustValue, error) {
|
||||
nm, err := i.NetMap.GetNetMap(1)
|
||||
if err != nil {
|
||||
|
@ -34,13 +34,13 @@ func (i InitialTrustSource) InitialTrust(reputation.PeerID) (reputation.TrustVal
|
|||
return reputation.TrustOne.Div(nodeCount), nil
|
||||
}
|
||||
|
||||
// DaughtersTrustCalculator wraps EigenTrust calculator and implements
|
||||
// DaughtersTrustCalculator wraps EigenTrust calculator and implements the
|
||||
// eigentrust/calculator's DaughtersTrustCalculator interface.
|
||||
type DaughtersTrustCalculator struct {
|
||||
Calculator *eigencalc.Calculator
|
||||
}
|
||||
|
||||
// Calculate converts and passes values to wrapped calculator.
|
||||
// Calculate converts and passes values to the wrapped calculator.
|
||||
func (c *DaughtersTrustCalculator) Calculate(ctx eigentrustctrl.IterationContext) {
|
||||
calcPrm := eigencalc.CalculatePrm{}
|
||||
epochIteration := eigentrust.EpochIteration{}
|
||||
|
|
|
@ -14,16 +14,16 @@ import (
|
|||
|
||||
var ErrIncorrectContextPanicMsg = "could not write intermediate trust: passed context incorrect"
|
||||
|
||||
// ConsumerStorageWriterProvider is implementation of reputation.WriterProvider
|
||||
// ConsumerStorageWriterProvider is an implementation of the reputation.WriterProvider
|
||||
// interface that provides ConsumerTrustWriter writer.
|
||||
type ConsumerStorageWriterProvider struct {
|
||||
Log *logger.Logger
|
||||
Storage *consumerstorage.Storage
|
||||
}
|
||||
|
||||
// ConsumerTrustWriter is implementation of reputation.Writer interface
|
||||
// that writes passed consumer's Trust values to Consumer storage. After writing
|
||||
// that values can be used in eigenTrust algorithm's iterations.
|
||||
// ConsumerTrustWriter is an implementation of the reputation.Writer interface
|
||||
// that writes passed consumer's Trust values to the Consumer storage. After writing
|
||||
// that, values can be used in eigenTrust algorithm's iterations.
|
||||
type ConsumerTrustWriter struct {
|
||||
log *logger.Logger
|
||||
storage *consumerstorage.Storage
|
||||
|
|
|
@ -43,7 +43,7 @@ func NewFinalWriterProvider(prm FinalWriterProviderPrm, opts ...FinalWriterOptio
|
|||
}
|
||||
}
|
||||
|
||||
// FinalWriterProvider is implementation of reputation.eigentrust.calculator
|
||||
// FinalWriterProvider is an implementation of the reputation.eigentrust.calculator
|
||||
// IntermediateWriterProvider interface. It inits FinalWriter.
|
||||
type FinalWriterProvider struct {
|
||||
prm FinalWriterProviderPrm
|
||||
|
@ -60,7 +60,7 @@ func (fwp FinalWriterProvider) InitIntermediateWriter(
|
|||
}, nil
|
||||
}
|
||||
|
||||
// FinalWriter is implementation of reputation.eigentrust.calculator IntermediateWriter
|
||||
// FinalWriter is an implementation of the reputation.eigentrust.calculator IntermediateWriter
|
||||
// interface that writes GlobalTrust to contract directly.
|
||||
type FinalWriter struct {
|
||||
privatKey *ecdsa.PrivateKey
|
||||
|
|
|
@ -10,16 +10,16 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// DaughterStorageWriterProvider is implementation of reputation.WriterProvider
|
||||
// DaughterStorageWriterProvider is an implementation of the reputation.WriterProvider
|
||||
// interface that provides DaughterTrustWriter writer.
|
||||
type DaughterStorageWriterProvider struct {
|
||||
Log *logger.Logger
|
||||
Storage *daughters.Storage
|
||||
}
|
||||
|
||||
// DaughterTrustWriter is implementation of reputation.Writer interface
|
||||
// DaughterTrustWriter is an implementation of the reputation.Writer interface
|
||||
// that writes passed daughter's Trust values to Daughter storage. After writing
|
||||
// that values can be used in eigenTrust algorithm's iterations.
|
||||
// that, values can be used in eigenTrust algorithm's iterations.
|
||||
type DaughterTrustWriter struct {
|
||||
log *logger.Logger
|
||||
storage *daughters.Storage
|
||||
|
|
|
@ -87,7 +87,7 @@ type RemoteTrustWriter struct {
|
|||
log *logger.Logger
|
||||
}
|
||||
|
||||
// Write sends trust value to remote node via ReputationService.AnnounceIntermediateResult RPC.
|
||||
// Write sends a trust value to a remote node via ReputationService.AnnounceIntermediateResult RPC.
|
||||
func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error {
|
||||
epoch := rtp.eiCtx.Epoch()
|
||||
i := rtp.eiCtx.I()
|
||||
|
|
|
@ -10,14 +10,14 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/storage/daughters"
|
||||
)
|
||||
|
||||
// DaughterTrustIteratorProvider is implementation of the
|
||||
// DaughterTrustIteratorProvider is an implementation of the
|
||||
// reputation/eigentrust/calculator's DaughterTrustIteratorProvider interface.
|
||||
type DaughterTrustIteratorProvider struct {
|
||||
DaughterStorage *daughters.Storage
|
||||
ConsumerStorage *consumerstorage.Storage
|
||||
}
|
||||
|
||||
// InitDaughterIterator returns iterator over received
|
||||
// InitDaughterIterator returns an iterator over the received
|
||||
// local trusts for ctx.Epoch() epoch from daughter p.
|
||||
func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc.Context,
|
||||
p reputation.PeerID) (eigentrustcalc.TrustIterator, error) {
|
||||
|
@ -34,7 +34,7 @@ func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc
|
|||
return daughterIterator, nil
|
||||
}
|
||||
|
||||
// InitAllDaughtersIterator returns iterator over all
|
||||
// InitAllDaughtersIterator returns an iterator over all
|
||||
// daughters of the current node(manager) and all local
|
||||
// trusts received from them for ctx.Epoch() epoch.
|
||||
func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator(
|
||||
|
@ -49,7 +49,7 @@ func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator(
|
|||
return iter, nil
|
||||
}
|
||||
|
||||
// InitConsumersIterator returns iterator over all daughters
|
||||
// InitConsumersIterator returns an iterator over all daughters
|
||||
// of the current node(manager) and all their consumers' local
|
||||
// trusts for ctx.Epoch() epoch and ctx.I() iteration.
|
||||
func (ip *DaughterTrustIteratorProvider) InitConsumersIterator(
|
||||
|
|
|
@ -15,7 +15,7 @@ type commonPrm struct {
|
|||
ctx context.Context
|
||||
}
|
||||
|
||||
// SetClient sets base client for NeoFS API communication.
|
||||
// SetClient sets the base client for NeoFS API communication.
|
||||
//
|
||||
// Required parameter.
|
||||
func (x *commonPrm) SetClient(cli coreclient.Client) {
|
||||
|
@ -36,24 +36,24 @@ type AnnounceLocalPrm struct {
|
|||
cliPrm client.PrmAnnounceLocalTrust
|
||||
}
|
||||
|
||||
// SetEpoch sets epoch in which the trust was assessed.
|
||||
// SetEpoch sets the epoch in which the trust was assessed.
|
||||
func (x *AnnounceLocalPrm) SetEpoch(epoch uint64) {
|
||||
x.cliPrm.SetEpoch(epoch)
|
||||
}
|
||||
|
||||
// SetTrusts sets list of local trust values.
|
||||
// SetTrusts sets a list of local trust values.
|
||||
func (x *AnnounceLocalPrm) SetTrusts(ts []reputation.Trust) {
|
||||
x.cliPrm.SetValues(ts)
|
||||
}
|
||||
|
||||
// AnnounceLocalRes groups resulting values of AnnounceLocal operation.
|
||||
// AnnounceLocalRes groups the resulting values of AnnounceLocal operation.
|
||||
type AnnounceLocalRes struct{}
|
||||
|
||||
// AnnounceLocal sends estimations of local trust to the remote node.
|
||||
//
|
||||
// Client, context and key must be set.
|
||||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
// Returns any error which prevented the operation from completing correctly in error return.
|
||||
func AnnounceLocal(prm AnnounceLocalPrm) (res AnnounceLocalRes, err error) {
|
||||
var cliRes *client.ResAnnounceLocalTrust
|
||||
|
||||
|
@ -73,30 +73,30 @@ type AnnounceIntermediatePrm struct {
|
|||
cliPrm client.PrmAnnounceIntermediateTrust
|
||||
}
|
||||
|
||||
// SetEpoch sets number of the epoch when the trust calculation's iteration was executed.
|
||||
// SetEpoch sets the number of the epoch when the trust calculation's iteration was executed.
|
||||
func (x *AnnounceIntermediatePrm) SetEpoch(epoch uint64) {
|
||||
x.cliPrm.SetEpoch(epoch)
|
||||
}
|
||||
|
||||
// SetIteration sets number of the iteration of the trust calculation algorithm.
|
||||
// SetIteration sets the number of the iteration of the trust calculation algorithm.
|
||||
func (x *AnnounceIntermediatePrm) SetIteration(iter uint32) {
|
||||
x.cliPrm.SetIteration(iter)
|
||||
}
|
||||
|
||||
// SetTrust sets current global trust value computed at the iteration.
|
||||
// SetTrust sets the current global trust value computed at the iteration.
|
||||
func (x *AnnounceIntermediatePrm) SetTrust(t reputation.PeerToPeerTrust) {
|
||||
x.cliPrm.SetCurrentValue(t)
|
||||
}
|
||||
|
||||
// AnnounceIntermediateRes groups resulting values of AnnounceIntermediate operation.
|
||||
// AnnounceIntermediateRes groups the resulting values of AnnounceIntermediate operation.
|
||||
type AnnounceIntermediateRes struct{}
|
||||
|
||||
// AnnounceIntermediate sends global trust value calculated at the specified iteration
|
||||
// AnnounceIntermediate sends the global trust value calculated at the specified iteration
|
||||
// and epoch to to the remote node.
|
||||
//
|
||||
// Client, context and key must be set.
|
||||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
// Returns any error which prevented the operation from completing correctly in error return.
|
||||
func AnnounceIntermediate(prm AnnounceIntermediatePrm) (res AnnounceIntermediateRes, err error) {
|
||||
var cliRes *client.ResAnnounceIntermediateTrust
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
// the Reputation service does not fully use the client's flexible interface.
|
||||
//
|
||||
// In this regard, this package provides functions over base API client necessary for the application.
|
||||
// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient
|
||||
// both when updating the base client and for evaluating the UX of SDK library). So it is expected that all
|
||||
// Reputation service packages will be limited to this package for the development of functionality requiring
|
||||
// This allows you to concentrate the entire spectrum of the client's use in one place (this will be convenient
|
||||
// both when updating the base client and for evaluating the UX of SDK library). So, it is expected that all
|
||||
// Reputation service packages will be limited to this package for the development of functionality requiring
|
||||
// NeoFS API communication.
|
||||
package internal
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
// IterationHandler is a callback of a certain block advance.
|
||||
type IterationHandler func()
|
||||
|
||||
// IterationsTicker represents fixed tick number block timer.
|
||||
// IterationsTicker represents a fixed tick number block timer.
|
||||
//
|
||||
// It can tick the blocks and perform certain actions
|
||||
// on block time intervals.
|
||||
|
@ -25,12 +25,12 @@ type IterationsTicker struct {
|
|||
|
||||
// NewIterationsTicker creates a new IterationsTicker.
|
||||
//
|
||||
// It guaranties that handler would be called the
|
||||
// It guaranties that a handler would be called the
|
||||
// specified amount of times in the specified amount
|
||||
// of blocks. After the last meaningful Tick IterationsTicker
|
||||
// of blocks. After the last meaningful Tick, IterationsTicker
|
||||
// becomes no-op timer.
|
||||
//
|
||||
// Returns error only if times is greater than totalBlocks.
|
||||
// Returns an error only if times is greater than totalBlocks.
|
||||
func NewIterationsTicker(totalBlocks uint64, times uint64, h IterationHandler) (*IterationsTicker, error) {
|
||||
period := totalBlocks / times
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue