Documentation
¶
Index ¶
- Variables
- func GetHeadValue(r db.KeyValueReader) (felt.Felt, error)
- func GetLenDB(r db.KeyValueReader) (int, error)
- func GetTailValue(r db.KeyValueReader) (felt.Felt, error)
- func GetTxn(r db.KeyValueReader, txnHash *felt.Felt) (dbPoolTxn, error)
- func WriteHeadValue(w db.KeyValueWriter, head *felt.Felt) error
- func WriteLenDB(w db.KeyValueWriter, l int) error
- func WriteTailValue(w db.KeyValueWriter, tail *felt.Felt) error
- func WriteTxn(w db.KeyValueWriter, item *dbPoolTxn) error
- type BroadcastedTransaction
- type Pool
- func (p *Pool) Close()
- func (p *Pool) Len() int
- func (p *Pool) LenDB() (int, error)
- func (p *Pool) LoadFromDB() error
- func (p *Pool) Pop() (BroadcastedTransaction, error)
- func (p *Pool) PopBatch(numToPop int) ([]BroadcastedTransaction, error)
- func (p *Pool) Push(userTxn *BroadcastedTransaction) error
- func (p *Pool) Remove(hash ...*felt.Felt) error
- func (p *Pool) Wait() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTxnPoolFull = errors.New("transaction pool is full") ErrTxnPoolEmpty = errors.New("transaction pool is empty") )
Functions ¶
func GetHeadValue ¶ added in v0.14.4
func GetHeadValue(r db.KeyValueReader) (felt.Felt, error)
func GetTailValue ¶ added in v0.14.4
func GetTailValue(r db.KeyValueReader) (felt.Felt, error)
func GetTxn ¶ added in v0.14.4
func GetTxn(r db.KeyValueReader, txnHash *felt.Felt) (dbPoolTxn, error)
func WriteHeadValue ¶ added in v0.14.4
func WriteHeadValue(w db.KeyValueWriter, head *felt.Felt) error
func WriteLenDB ¶ added in v0.14.4
func WriteLenDB(w db.KeyValueWriter, l int) error
func WriteTailValue ¶ added in v0.14.4
func WriteTailValue(w db.KeyValueWriter, tail *felt.Felt) error
func WriteTxn ¶ added in v0.14.4
func WriteTxn(w db.KeyValueWriter, item *dbPoolTxn) error
Types ¶
type BroadcastedTransaction ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represents a blockchain mempool, managing transactions using both an in-memory and persistent database.
func New ¶
func New(mainDB db.KeyValueStore, bc blockchain.Reader, maxNumTxns int, log utils.SimpleLogger) *Pool
New initialises the Pool and starts the database writer goroutine. It is the responsibility of the caller to execute the closer function.
func (*Pool) LoadFromDB ¶
LoadFromDB restores the in-memory transaction pool from the database
func (*Pool) Pop ¶
func (p *Pool) Pop() (BroadcastedTransaction, error)
Pop returns the transaction with the highest priority from the in-memory pool
func (*Pool) PopBatch ¶ added in v0.14.4
func (p *Pool) PopBatch(numToPop int) ([]BroadcastedTransaction, error)
PopBatch returns a batch of transactions with the highest priority from the in-memory pool
func (*Pool) Push ¶
func (p *Pool) Push(userTxn *BroadcastedTransaction) error
Push queues a transaction to the pool
Click to show internal directories.
Click to hide internal directories.