github.com/koko1123/flow-go-1@v0.29.6/module/mempool/transaction_timings.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  // TransactionTimings represents a concurrency-safe memory pool for transaction timings.
    10  type TransactionTimings interface {
    11  
    12  	// Add adds a transaction timing to the mempool.
    13  	Add(tx *flow.TransactionTiming) bool
    14  
    15  	// ByID returns the transaction timing with the given ID from the mempool.
    16  	ByID(txID flow.Identifier) (*flow.TransactionTiming, bool)
    17  	// Adjust will adjust the transaction timing using the given function if the given key can be found.
    18  	// Returns a bool which indicates whether the value was updated as well as the updated value.
    19  	Adjust(txID flow.Identifier, f func(*flow.TransactionTiming) *flow.TransactionTiming) (*flow.TransactionTiming,
    20  		bool)
    21  
    22  	// All returns all transaction timings from the mempool.
    23  	All() []*flow.TransactionTiming
    24  
    25  	// Remove removes the transaction timing with the given ID.
    26  	Remove(txID flow.Identifier) bool
    27  }