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

     1  package mempool
     2  
     3  import (
     4  	"github.com/onflow/flow-go/model/flow"
     5  	"github.com/onflow/flow-go/module/executiondatasync/execution_data"
     6  )
     7  
     8  // ExecutionData represents a concurrency-safe memory pool for BlockExecutionData.
     9  type ExecutionData interface {
    10  
    11  	// Has checks whether the block execution data for the given block ID is currently in
    12  	// the memory pool.
    13  	Has(flow.Identifier) bool
    14  
    15  	// Add adds a block execution data to the mempool, keyed by block ID.
    16  	// It returns false if the execution data was already in the mempool.
    17  	Add(*execution_data.BlockExecutionDataEntity) bool
    18  
    19  	// Remove removes block execution data from mempool by block ID.
    20  	// It returns true if the execution data was known and removed.
    21  	Remove(flow.Identifier) bool
    22  
    23  	// ByID returns the block execution data for the given block ID from the mempool.
    24  	// It returns false if the execution data was not found in the mempool.
    25  	ByID(flow.Identifier) (*execution_data.BlockExecutionDataEntity, bool)
    26  
    27  	// Size return the current size of the memory pool.
    28  	Size() uint
    29  
    30  	// All retrieves all execution data that are currently in the memory pool
    31  	// as a slice.
    32  	All() []*execution_data.BlockExecutionDataEntity
    33  
    34  	// Clear removes all execution data from the mempool.
    35  	Clear()
    36  }