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