github.com/koko1123/flow-go-1@v0.29.6/module/mempool/guarantees.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 // Guarantees represents a concurrency-safe memory pool for collection guarantees. 10 type Guarantees interface { 11 12 // Has checks whether the collection guarantee with the given hash is 13 // currently in the memory pool. 14 Has(collID flow.Identifier) bool 15 16 // Add will add the given collection guarantee to the memory pool. It will 17 // return false if it was already in the mempool. 18 Add(guarantee *flow.CollectionGuarantee) bool 19 20 // Remove will remove the given collection guarantees from the memory pool; it 21 // will return true if the collection guarantees was known and removed. 22 Remove(collID flow.Identifier) bool 23 24 // ByID retrieve the collection guarantee with the given ID from the memory 25 // pool. It will return false if it was not found in the mempool. 26 ByID(collID flow.Identifier) (*flow.CollectionGuarantee, bool) 27 28 // Size will return the current size of the memory pool. 29 Size() uint 30 31 // All will retrieve all collection guarantees that are currently in the memory pool 32 // as a slice. 33 All() []*flow.CollectionGuarantee 34 }