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

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