# Functions
No description provided by the author
NewMetricsDB creates a new LevelDB instance used to persist metrics definedinside p2p/protocols/accounting.go.
NewPeer constructs a new peer this constructor is called by the p2p.Protocol#Run function the first two arguments are the arguments passed to p2p.Protocol.Run function the third argument is the Spec describing the protocol.
SetupAccountingMetrics creates a separate registry for p2p accounting metrics;this registry should be independent of any other metrics as it persists at different endpoints.It also instantiates the given metrics and starts the persisting go-routine whichat the passed interval writes the metrics to a LevelDB.
# Constants
error codes used by this protocol scheme.
error codes used by this protocol scheme.
error codes used by this protocol scheme.
error codes used by this protocol scheme.
error codes used by this protocol scheme.
error codes used by this protocol scheme.
error codes used by this protocol scheme.
error codes used by this protocol scheme.
No description provided by the author
No description provided by the author
# Structs
Accounting implements the Hook interfaceIt interfaces to the balances through the Balance interface,while interfacing with protocols and its prices through the Prices interface.
AccountMetrics abstracts away the metrics DB andthe reporter to persist metrics.
Error implements the standard go error interface.
Peer represents a remote peer or protocol instance that is running on a peer connection with a remote peer.
Price represents the costs of a message.
Spec is a protocol specification including its name and version as well as the types of messages which are exchanged.
WrappedMsg is used to propagate marshalled context alongside message payloads.
# Interfaces
Balance is the actual accounting instanceBalance defines the operations needed for accountingImplementations internally maintain the balance for every peer.
For accounting, the design is to allow the Spec to describe which and how its messages are pricedTo access this functionality, we provide a Hook interface which will call accounting methodsNOTE: there could be more such (horizontal) hooks in the future.
Prices defines how prices are being passed on to the accounting instance.
# Type aliases
No description provided by the author