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