github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/mempool/transactions.go (about) 1 package mempool 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 ) 6 7 // Transactions represents a concurrency-safe memory pool for transactions. 8 type Transactions interface { 9 10 // Has checks whether the transaction with the given hash is currently in 11 // the memory pool. 12 Has(txID flow.Identifier) bool 13 14 // Add will add the given transaction body to the memory pool. It will 15 // return false if it was already in the mempool. 16 Add(tx *flow.TransactionBody) bool 17 18 // Remove will remove the given transaction from the memory pool; it will 19 // will return true if the transaction was known and removed. 20 Remove(txID flow.Identifier) bool 21 22 // ByID retrieve the transaction with the given ID from the memory 23 // pool. It will return false if it was not found in the mempool. 24 ByID(txID flow.Identifier) (*flow.TransactionBody, bool) 25 26 // Size will return the current size of the memory pool. 27 Size() uint 28 29 // All will retrieve all transactions that are currently in the memory pool 30 // as a slice. 31 All() []*flow.TransactionBody 32 33 // Clear removes all transactions from the mempool. 34 Clear() 35 }