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