github.com/koko1123/flow-go-1@v0.29.6/module/mempool/pending_receipts.go (about)

     1  package mempool
     2  
     3  import "github.com/koko1123/flow-go-1/model/flow"
     4  
     5  // PendingReceipts stores pending receipts indexed by the id.
     6  // It also maintains a secondary index on the previous result id, which is unique,
     7  // in order to allow to find a receipt by the previous result id.
     8  type PendingReceipts interface {
     9  	// Add a pending receipt
    10  	// return true if added
    11  	// return false if is a duplication
    12  	Add(receipt *flow.ExecutionReceipt) bool
    13  
    14  	// Remove a pending receipt by ID
    15  	Remove(receiptID flow.Identifier) bool
    16  
    17  	// ByPreviousResultID returns all the pending receipts whose previous result id
    18  	// matches the given result id
    19  	ByPreviousResultID(previousReusltID flow.Identifier) []*flow.ExecutionReceipt
    20  
    21  	// PruneUpToHeight remove all receipts for blocks whose height is strictly
    22  	// smaller that height. Note: receipts for blocks at height are retained.
    23  	// After pruning, receipts below for blocks below the given height are dropped.
    24  	//
    25  	// Monotonicity Requirement:
    26  	// The pruned height cannot decrease, as we cannot recover already pruned elements.
    27  	// If `height` is smaller than the previous value, the previous value is kept
    28  	// and the sentinel mempool.DecreasingPruningHeightError is returned.
    29  	PruneUpToHeight(height uint64) error
    30  }