Documentation
¶
Overview ¶
Package pool defines the interface for a transaction pool. It will hold the transactions of the clients until an ordering service read them and it will broadcast the state of the pool to other known participants.
Index ¶
Constants ¶
const DefaultIdentitySize = 100
DefaultIdentitySize is the default size defined for each identity to store transactions.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Min indicates what is minimum number of transactions that is required // before returning. Min int // Callback is a function called when the pool doesn't have enough // transactions at the moment of calling and must therefore wait for new // transactions to come. It allows one to take action to stop the gathering // if necessary. Callback func() }
Config is the set of parameters that allows one to change the behavior of the gathering process.
type Filter ¶
type Filter interface { // Accept returns an error when the transaction is going to be rejected. Accept(tx txn.Transaction, leeway validation.Leeway) error }
Filter is the interface to implement to validate if a transaction will be accepted and thus is allowed to be pushed in the pool.
type Gatherer ¶
type Gatherer interface { // AddFilter adds the filter to the list that a transaction will go through // before being accepted by the gatherer. AddFilter(Filter) // Add adds the transaction to the list of pending transactions. Add(tx txn.Transaction) error // Remove removes a transaction from the list of pending ones. Remove(tx txn.Transaction) error // Wait waits for a notification with sufficient transactions to return the // array, or nil if the context ends. Wait(ctx context.Context, cfg Config) []txn.Transaction // Close closes current operations and cleans the resources. Close() // Stats gets the transaction statistics. Stats() Stats // ResetStats resets the transaction statistics. ResetStats() }
Gatherer is a common tool to the pool implementations that helps to implement the gathering process.
func NewSimpleGatherer ¶
func NewSimpleGatherer() Gatherer
NewSimpleGatherer creates a new gatherer.
type Pool ¶
type Pool interface { // SetPlayers updates the list of participants that should eventually // receive the transactions. SetPlayers(mino.Players) error AddFilter(Filter) // Add adds the transaction to the pool. Add(txn.Transaction) error // Remove removes the transaction from the pool. Remove(txn.Transaction) error // Gather is a blocking function to gather transactions from the pool. The // configuration allows one to specify criterion before returning. Gather(context.Context, Config) []txn.Transaction // Stats gets the transactions statistics Stats() Stats // ResetStats resets the transaction statistics. ResetStats() // Close closes the pool and cleans the resources. Close() error }
Pool is the maintainer of the list of transactions.
Directories
¶
Path | Synopsis |
---|---|
Package controller implements a controller for the pool
|
Package controller implements a controller for the pool |
Package gossip implements a transaction pool that is using a gossip protocol to spread the transactions to other participants.
|
Package gossip implements a transaction pool that is using a gossip protocol to spread the transactions to other participants. |