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 reputation.PeerID) (eigentrustcalc.TrustIterator, error)
- type DaughterTrustWriter
- type DaughtersTrustCalculator
- type ErrNoData
- 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 *logger.Logger Storage *consumerstorage.Storage }
ConsumerStorageWriterProvider is implementation of 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 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.
func (*ConsumerTrustWriter) Close ¶
func (w *ConsumerTrustWriter) Close() error
func (*ConsumerTrustWriter) Write ¶
func (w *ConsumerTrustWriter) Write(t reputation.Trust) error
type DaughterStorageWriterProvider ¶
DaughterStorageWriterProvider is implementation of 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 implementation of the reputation/eigentrust/calculator's DaughterTrustIteratorProvider interface.
func (*DaughterTrustIteratorProvider) InitAllDaughtersIterator ¶
func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator( ctx eigentrustcalc.Context) (eigentrustcalc.PeerTrustsIterator, error)
InitAllDaughtersIterator returns iterator over all daughters of the current node(manager) and all local trusts received from them for ctx.Epoch() epoch.
Returns ErrNoData if there is no trust data for specified epoch.
func (*DaughterTrustIteratorProvider) InitConsumersIterator ¶
func (ip *DaughterTrustIteratorProvider) InitConsumersIterator( ctx eigentrustcalc.Context) (eigentrustcalc.PeerTrustsIterator, error)
InitConsumersIterator returns iterator over all daughters of the current node(manager) and all their consumers' local trusts for ctx.Epoch() epoch and ctx.I() iteration.
Returns ErrNoData if there is no trust data for specified epoch and iteration.
func (*DaughterTrustIteratorProvider) InitDaughterIterator ¶
func (ip *DaughterTrustIteratorProvider) InitDaughterIterator(ctx eigentrustcalc.Context, p reputation.PeerID) (eigentrustcalc.TrustIterator, error)
InitDaughterIterator returns iterator over received local trusts for ctx.Epoch() epoch from daughter p.
Returns ErrNoData if there is no trust data for specified epoch and daughter's PeerId.
type DaughterTrustWriter ¶
type DaughterTrustWriter struct {
// contains filtered or unexported fields
}
DaughterTrustWriter is implementation of 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 eigentrust/calculator's DaughtersTrustCalculator interface.
func (*DaughtersTrustCalculator) Calculate ¶
func (c *DaughtersTrustCalculator) Calculate(ctx eigentrustctrl.IterationContext)
Calculate converts and passes values to wrapped calculator.
type FinalWriter ¶
type FinalWriter struct {
// contains filtered or unexported fields
}
FinalWriter is implementation of 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 *logger.Logger) FinalWriterOption
type FinalWriterProvider ¶
type FinalWriterProvider struct {
// contains filtered or unexported fields
}
FinalWriterProvider is implementation of 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 *wrapper.ClientWrapper }
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 implementation of the reputation/eigentrust/calculator's InitialTrustSource interface.
func (InitialTrustSource) InitialTrust ¶
func (i InitialTrustSource) InitialTrust(reputation.PeerID) (reputation.TrustValue, error)
InitialTrust returns `initialTrust` as 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 apiClient.Client) reputationcommon.WriterProvider
type RemoteProviderPrm ¶
type RemoteProviderPrm struct {
Key *ecdsa.PrivateKey
}
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 trust value to 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)