github.com/koko1123/flow-go-1@v0.29.6/module/mempool/state_deltas.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  	"github.com/koko1123/flow-go-1/model/messages"
     8  )
     9  
    10  // Deltas represents a concurrency-safe memory pool for block deltas.
    11  type Deltas interface {
    12  
    13  	// Has checks whether the block delta with the given hash is currently in
    14  	// the memory pool.
    15  	Has(blockID flow.Identifier) bool
    16  
    17  	// Add will add the given block delta to the memory pool. It will return
    18  	// false if it was already in the mempool.
    19  	Add(delta *messages.ExecutionStateDelta) bool
    20  
    21  	// Remove will remove the given block delta from the memory pool; it will
    22  	// will return true if the block delta was known and removed.
    23  	Remove(blockID flow.Identifier) bool
    24  
    25  	// ByID retrieve the block delta with the given ID from the memory
    26  	// pool. It will return false if it was not found in the mempool.
    27  	ByBlockID(blockID flow.Identifier) (*messages.ExecutionStateDelta, bool)
    28  
    29  	// Size will return the current size of the memory pool.
    30  	Size() uint
    31  
    32  	// Limit will return the maximum size of the memory pool
    33  	Limit() uint
    34  
    35  	// All will retrieve all block deltas that are currently in the memory pool
    36  	// as a slice.
    37  	All() []*messages.ExecutionStateDelta
    38  }