[#488] reputation/eigentrust/calculator: Implement calc wrapper

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-04-29 08:30:41 +03:00 committed by Alex Vanin
parent d3c1fc7dda
commit ea781664cf
14 changed files with 294 additions and 53 deletions

View file

@ -28,13 +28,27 @@ type TrustIterator interface {
type PeerTrustsHandler func(reputation.PeerID, TrustIterator) error
// PeerTrustsIterator must iterate over all nodes(PeerIDs) and provide
// TrustIterator for iteration over node's Trusts to others peers.
type PeerTrustsIterator interface {
Iterate(PeerTrustsHandler) error
}
type DaughterTrustIteratorProvider interface {
InitDaughterIterator(Context, reputation.PeerID) (TrustIterator, error)
InitAllDaughtersIterator(Context) (PeerTrustsIterator, error)
// InitDaughterIterator must init TrustIterator
// that iterates over received local trusts from
// daughter p for ctx.Epoch() epoch.
InitDaughterIterator(ctx Context, p reputation.PeerID) (TrustIterator, error)
// InitAllDaughtersIterator must init PeerTrustsIterator
// that must iterate over all daughters of the current
// node(manager) and all trusts received from them for
// ctx.Epoch() epoch.
InitAllDaughtersIterator(ctx Context) (PeerTrustsIterator, error)
// InitConsumersIterator must init PeerTrustsIterator
// that must iterate over all daughters of the current
// node(manager) and their consumers' trusts received
// from other managers for ctx.Epoch() epoch and
// ctx.I() iteration.
InitConsumersIterator(Context) (PeerTrustsIterator, error)
}