reputation

package
v0.0.0-...-c01ea1d Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reputation

type Reputation interface {
	PeerID() peer.ID
	Value() float64
	StrongPenalize() Reputation
	WeakPenalize() Reputation
	Reward() Reputation
}

type ReputationStore

type ReputationStore interface {
	// Update allows modification of the reputation corresponding to the provided peer.
	//
	// The reputation returned from writeFunc is used to persist any changes. This applies
	// even if writeFunc also returns an error. Return a nil reputation to signal that no
	// persistence should occur.
	Update(peerID peer.ID, writeFunc func(rep Reputation) (Reputation, error)) error
	Read(peerID peer.ID, readFunc func(rep Reputation) error) error
}

ReputationStore represents some sort of backing storage for the reputation information about a node's peers.

All nodes are considered having a reputation at all times. This means that all operations on a reputation store must always pass a meaningful value to the readFunc or writeFunc. Implementations are free to approach this however they please.

type TrustFunction

type TrustFunction = func(rep Reputation) (bool, error)

Jump to

Keyboard shortcuts

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