intermediate

package
v0.22.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyNetMap = errors.New("empty NepMap")
View Source
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

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

type DaughterStorageWriterProvider

type DaughterStorageWriterProvider struct {
	Log     *logger.Logger
	Storage *daughters.Storage
}

DaughterStorageWriterProvider is implementation of reputation.WriterProvider interface that provides DaughterTrustWriter writer.

func (*DaughterStorageWriterProvider) InitWriter

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

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

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

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

type DaughtersTrustCalculator

type DaughtersTrustCalculator struct {
	Calculator *eigencalc.Calculator
}

DaughtersTrustCalculator wraps EigenTrust calculator and implements eigentrust/calculator's DaughtersTrustCalculator interface.

func (*DaughtersTrustCalculator) Calculate

Calculate converts and passes values to wrapped calculator.

type ErrNoData

type ErrNoData struct {
	// contains filtered or unexported fields
}

func (*ErrNoData) Error

func (e *ErrNoData) Error() string

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

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

type InitialTrustSource struct {
	NetMap netmap.Source
}

InitialTrustSource is implementation of the reputation/eigentrust/calculator's InitialTrustSource interface.

func (InitialTrustSource) InitialTrust

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

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() (err error)

Close sends all cached intermediate trusts. If error occurs, returns in immediately and stops iteration.

func (*RemoteTrustWriter) Write

func (rtp *RemoteTrustWriter) Write(t reputation.Trust) error

Write check if passed context contains required data(returns ErrIncorrectContext if not) and caches passed trusts(as SendIntermediateTrustPrm structs).

type TrustWriterProvider

type TrustWriterProvider struct {
	// contains filtered or unexported fields
}

func (*TrustWriterProvider) InitWriter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL