Documentation ¶
Index ¶
- Variables
- type ConsumerStorageWriterProvider
- type ConsumerTrustWriter
- type DaughterStorageWriterProvider
- type DaughterTrustIteratorProvider
- func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator(ctx eigentrustcalc.Context) (eigentrustcalc.PeerTrustsIterator, error)
- func (ip *DaughterTrustIteratorProvider) InitConsumersIterator(ctx eigentrustcalc.Context) (eigentrustcalc.PeerTrustsIterator, error)
- func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc.Context, p apireputation.PeerID) (eigentrustcalc.TrustIterator, error)
- type DaughterTrustWriter
- type DaughtersTrustCalculator
- type FinalWriter
- type FinalWriterOption
- type FinalWriterProvider
- type FinalWriterProviderPrm
- type InitialTrustSource
- type RemoteProvider
- type RemoteProviderPrm
- type RemoteTrustWriter
- type TrustWriterProvider
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyNetMap = errors.New("empty NepMap")
var ErrIncorrectContextPanicMsg = "could not write intermediate trust: passed context incorrect"
Functions ¶
This section is empty.
Types ¶
type ConsumerStorageWriterProvider ¶
type ConsumerStorageWriterProvider struct { Log *zap.Logger Storage *consumerstorage.Storage }
ConsumerStorageWriterProvider is an implementation of the reputation.WriterProvider interface that provides ConsumerTrustWriter writer.
func (*ConsumerStorageWriterProvider) InitWriter ¶
func (s *ConsumerStorageWriterProvider) InitWriter(ctx reputationcommon.Context) (reputationcommon.Writer, error)
type ConsumerTrustWriter ¶
type ConsumerTrustWriter struct {
// contains filtered or unexported fields
}
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.
func (*ConsumerTrustWriter) Close ¶
func (w *ConsumerTrustWriter) Close() error
func (*ConsumerTrustWriter) Write ¶
func (w *ConsumerTrustWriter) Write(t reputation.Trust) error
type DaughterStorageWriterProvider ¶
DaughterStorageWriterProvider is an implementation of the reputation.WriterProvider interface that provides DaughterTrustWriter writer.
func (*DaughterStorageWriterProvider) InitWriter ¶
func (s *DaughterStorageWriterProvider) InitWriter(ctx reputationcommon.Context) (reputationcommon.Writer, error)
type DaughterTrustIteratorProvider ¶
type DaughterTrustIteratorProvider struct { DaughterStorage *daughters.Storage ConsumerStorage *consumerstorage.Storage }
DaughterTrustIteratorProvider is an implementation of the reputation/eigentrust/calculator's DaughterTrustIteratorProvider interface.
func (*DaughterTrustIteratorProvider) InitAllDaughtersIterator ¶
func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator( ctx eigentrustcalc.Context) (eigentrustcalc.PeerTrustsIterator, error)
InitAllDaughtersIterator returns an iterator over all daughters of the current node(manager) and all local trusts received from them for ctx.Epoch() epoch.
func (*DaughterTrustIteratorProvider) InitConsumersIterator ¶
func (ip *DaughterTrustIteratorProvider) InitConsumersIterator( ctx eigentrustcalc.Context) (eigentrustcalc.PeerTrustsIterator, error)
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 (*DaughterTrustIteratorProvider) InitDaughterIterator ¶
func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc.Context, p apireputation.PeerID) (eigentrustcalc.TrustIterator, error)
InitDaughterIterator returns an iterator over the received local trusts for ctx.Epoch() epoch from daughter p.
type DaughterTrustWriter ¶
type DaughterTrustWriter struct {
// contains filtered or unexported fields
}
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.
func (*DaughterTrustWriter) Close ¶
func (w *DaughterTrustWriter) Close() error
func (*DaughterTrustWriter) Write ¶
func (w *DaughterTrustWriter) Write(t reputation.Trust) error
type DaughtersTrustCalculator ¶
type DaughtersTrustCalculator struct {
Calculator *eigencalc.Calculator
}
DaughtersTrustCalculator wraps EigenTrust calculator and implements the eigentrust/calculator's DaughtersTrustCalculator interface.
func (*DaughtersTrustCalculator) Calculate ¶
func (c *DaughtersTrustCalculator) Calculate(ctx eigentrustctrl.IterationContext)
Calculate converts and passes values to the wrapped calculator.
type FinalWriter ¶
type FinalWriter struct {
// contains filtered or unexported fields
}
FinalWriter is an implementation of the reputation.eigentrust.calculator IntermediateWriter interface that writes GlobalTrust to contract directly.
func (FinalWriter) WriteIntermediateTrust ¶
func (fw FinalWriter) WriteIntermediateTrust(t eigentrust.IterationTrust) error
type FinalWriterOption ¶
type FinalWriterOption func(*finalWriterOptions)
func FinalWriterWithLogger ¶
func FinalWriterWithLogger(l *zap.Logger) FinalWriterOption
type FinalWriterProvider ¶
type FinalWriterProvider struct {
// contains filtered or unexported fields
}
FinalWriterProvider is an implementation of the reputation.eigentrust.calculator IntermediateWriterProvider interface. It inits FinalWriter.
func NewFinalWriterProvider ¶
func NewFinalWriterProvider(prm FinalWriterProviderPrm, opts ...FinalWriterOption) *FinalWriterProvider
NewFinalWriterProvider creates a new instance of the FinalWriterProvider.
Panics if at least one value of the parameters is invalid.
The created FinalWriterProvider does not require additional initialization and is completely ready for work.
func (FinalWriterProvider) InitIntermediateWriter ¶
func (fwp FinalWriterProvider) InitIntermediateWriter( _ eigentrustcalc.Context) (eigentrustcalc.IntermediateWriter, error)
type FinalWriterProviderPrm ¶
type FinalWriterProviderPrm struct { PrivatKey *ecdsa.PrivateKey PubKey []byte Client *repClient.Client }
FinalWriterProviderPrm groups the required parameters of the FinalWriterProvider's constructor.
All values must comply with the requirements imposed on them. Passing incorrect parameter values will result in constructor failure (error or panic depending on the implementation).
type InitialTrustSource ¶
InitialTrustSource is an implementation of the reputation/eigentrust/calculator's InitialTrustSource interface.
func (InitialTrustSource) InitialTrust ¶
func (i InitialTrustSource) InitialTrust(apireputation.PeerID) (reputation.TrustValue, error)
InitialTrust returns `initialTrust` as an initial trust value.
type RemoteProvider ¶
type RemoteProvider struct {
// contains filtered or unexported fields
}
RemoteProvider is an implementation of the clientKeyRemoteProvider interface.
func NewRemoteProvider ¶
func NewRemoteProvider(prm RemoteProviderPrm) *RemoteProvider
NewRemoteProvider creates a new instance of the RemoteProvider.
Panics if at least one value of the parameters is invalid.
The created RemoteProvider does not require additional initialization and is completely ready for work.
func (RemoteProvider) WithClient ¶
func (rp RemoteProvider) WithClient(c coreclient.Client) reputationcommon.WriterProvider
type RemoteProviderPrm ¶
type RemoteProviderPrm struct { Key *ecdsa.PrivateKey Log *zap.Logger }
RemoteProviderPrm groups the required parameters of the RemoteProvider's constructor.
All values must comply with the requirements imposed on them. Passing incorrect parameter values will result in constructor failure (error or panic depending on the implementation).
type RemoteTrustWriter ¶
type RemoteTrustWriter struct {
// contains filtered or unexported fields
}
func (*RemoteTrustWriter) Close ¶
func (rtp *RemoteTrustWriter) Close() error
func (*RemoteTrustWriter) Write ¶
func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error
Write sends a trust value to a remote node via ReputationService.AnnounceIntermediateResult RPC.
type TrustWriterProvider ¶
type TrustWriterProvider struct {
// contains filtered or unexported fields
}
func (*TrustWriterProvider) InitWriter ¶
func (twp *TrustWriterProvider) InitWriter(ctx reputationcommon.Context) (reputationcommon.Writer, error)