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

     1  package mempool
     2  
     3  import (
     4  	"github.com/onflow/flow-go/model/flow"
     5  )
     6  
     7  // IncorporatedResultSeals represents a concurrency safe memory pool for
     8  // incorporated result seals
     9  type IncorporatedResultSeals interface {
    10  	// Add adds an IncorporatedResultSeal to the mempool
    11  	Add(irSeal *flow.IncorporatedResultSeal) (bool, error)
    12  
    13  	// All returns all the IncorporatedResultSeals in the mempool
    14  	All() []*flow.IncorporatedResultSeal
    15  
    16  	// ByID returns an IncorporatedResultSeal by ID
    17  	ByID(flow.Identifier) (*flow.IncorporatedResultSeal, bool)
    18  
    19  	// Limit returns the size limit of the mempool
    20  	Limit() uint
    21  
    22  	// Remove removes an IncorporatedResultSeal from the mempool
    23  	Remove(incorporatedResultID flow.Identifier) bool
    24  
    25  	// Size returns the number of items in the mempool
    26  	Size() uint
    27  
    28  	// Clear removes all entities from the pool.
    29  	Clear()
    30  
    31  	// PruneUpToHeight remove all seals for blocks whose height is strictly
    32  	// smaller that height. Note: seals for blocks at height are retained.
    33  	// After pruning, seals below for blocks below the given height are dropped.
    34  	//
    35  	// Monotonicity Requirement:
    36  	// The pruned height cannot decrease, as we cannot recover already pruned elements.
    37  	// If `height` is smaller than the previous value, the previous value is kept
    38  	// and the sentinel mempool.BelowPrunedThresholdError is returned.
    39  	PruneUpToHeight(height uint64) error
    40  }