[#488] reputation: Add commentaries
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
2c8c9f69c8
commit
eb74a9cafc
8 changed files with 38 additions and 13 deletions
|
@ -14,11 +14,16 @@ import (
|
|||
|
||||
var ErrIncorrectContext = errors.New("could not write intermediate trust: passed context incorrect")
|
||||
|
||||
// ConsumerStorageWriterProvider is implementation of 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.
|
||||
type ConsumerTrustWriter struct {
|
||||
log *logger.Logger
|
||||
storage *consumerstorage.Storage
|
||||
|
|
|
@ -42,6 +42,8 @@ func NewFinalWriterProvider(prm FinalWriterProviderPrm, opts ...FinalWriterOptio
|
|||
}
|
||||
}
|
||||
|
||||
// FinalWriterProvider is implementation of reputation.eigentrust.calculator
|
||||
// IntermediateWriterProvider interface. It inits FinalWriter.
|
||||
type FinalWriterProvider struct {
|
||||
prm FinalWriterProviderPrm
|
||||
opts *finalWriterOptions
|
||||
|
@ -55,9 +57,10 @@ func (fwp FinalWriterProvider) InitIntermediateWriter(
|
|||
client: fwp.prm.Client,
|
||||
l: fwp.opts.log,
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
// FinalWriter is implementation of reputation.eigentrust.calculator IntermediateWriter
|
||||
// interface that writes GlobalTrust to contract directly.
|
||||
type FinalWriter struct {
|
||||
privatKey *ecdsa.PrivateKey
|
||||
pubKey []byte
|
||||
|
|
|
@ -8,11 +8,16 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
)
|
||||
|
||||
// DaughterStorageWriterProvider is implementation of reputation.WriterProvider
|
||||
// interface that provides DaughterTrustWriter writer.
|
||||
type DaughterStorageWriterProvider struct {
|
||||
Log *logger.Logger
|
||||
Storage *daughters.Storage
|
||||
}
|
||||
|
||||
// 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.
|
||||
type DaughterTrustWriter struct {
|
||||
log *logger.Logger
|
||||
storage *daughters.Storage
|
||||
|
|
|
@ -33,7 +33,7 @@ type ErrNoData struct {
|
|||
|
||||
func (e *ErrNoData) Error() string {
|
||||
if e.hasDaughter {
|
||||
return fmt.Sprintf("no data in %d epoch for peer: %s", e.epoch, e.daughter)
|
||||
return fmt.Sprintf("no data in %d epoch for peer: %s", e.epoch, string(e.daughter.Bytes()))
|
||||
}
|
||||
|
||||
return fmt.Sprintf("no daughter data in %d epoch", e.epoch)
|
||||
|
@ -72,7 +72,6 @@ func (ip *DaughterTrustIteratorProvider) InitAllDaughtersIterator(
|
|||
}
|
||||
|
||||
return iter, nil
|
||||
|
||||
}
|
||||
|
||||
// InitConsumersIterator returns iterator over all daughters
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue