github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/mempool/chunk_data_packs.go (about)

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