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