Documentation ¶
Overview ¶
(c) 2019 Dapper Labs - ALL RIGHTS RESERVED
Index ¶
- func EjectFakeRandom(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
- func EjectPanic(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
- func EjectTrueRandom(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
- type Approvals
- func (a *Approvals) Add(approval *flow.ResultApproval) (bool, error)
- func (a *Approvals) All() []*flow.ResultApproval
- func (a *Approvals) ByChunk(resultID flow.Identifier, chunkIndex uint64) map[flow.Identifier]*flow.ResultApproval
- func (a *Approvals) RemApproval(approval *flow.ResultApproval) (bool, error)
- func (a *Approvals) RemChunk(resultID flow.Identifier, chunkIndex uint64) (bool, error)
- func (a *Approvals) Size() uint
- type Assignments
- func (a *Assignments) Add(fingerprint flow.Identifier, assignment *chunkmodels.Assignment) bool
- func (a *Assignments) All() []*chunkmodels.Assignment
- func (a *Assignments) ByID(assignmentID flow.Identifier) (*chunkmodels.Assignment, bool)
- func (a *Assignments) Has(assignmentID flow.Identifier) bool
- func (a *Assignments) Rem(assignmentID flow.Identifier) bool
- func (a *Assignments) Size() uint
- type Backdata
- func (b *Backdata) Add(entity flow.Entity) bool
- func (b *Backdata) Adjust(entityID flow.Identifier, f func(flow.Entity) flow.Entity) (flow.Entity, bool)
- func (b *Backdata) All() []flow.Entity
- func (b *Backdata) ByID(entityID flow.Identifier) (flow.Entity, bool)
- func (b *Backdata) Clear()
- func (b *Backdata) Has(entityID flow.Identifier) bool
- func (b *Backdata) Hash() flow.Identifier
- func (b *Backdata) Rem(entityID flow.Identifier) bool
- func (b *Backdata) Size() uint
- type Backend
- func (b *Backend) Add(entity flow.Entity) bool
- func (b *Backend) Adjust(entityID flow.Identifier, f func(flow.Entity) flow.Entity) (flow.Entity, bool)
- func (b *Backend) All() []flow.Entity
- func (b *Backend) ByID(entityID flow.Identifier) (flow.Entity, bool)
- func (b *Backend) Clear()
- func (b *Backend) Has(entityID flow.Identifier) bool
- func (b *Backend) Hash() flow.Identifier
- func (b *Backend) Limit() uint
- func (b *Backend) RegisterEjectionCallbacks(callbacks ...mempool.OnEjection)
- func (b *Backend) Rem(entityID flow.Identifier) bool
- func (b *Backend) Run(f func(backdata map[flow.Identifier]flow.Entity) error) error
- func (b *Backend) Size() uint
- type BlockByCollectionBackdata
- type BlockByCollections
- type Blocks
- type ChunkDataPacks
- func (c *ChunkDataPacks) Add(cdp *flow.ChunkDataPack) bool
- func (c *ChunkDataPacks) All() []*flow.ChunkDataPack
- func (c *ChunkDataPacks) ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPack, bool)
- func (c *ChunkDataPacks) Has(chunkID flow.Identifier) bool
- func (c *ChunkDataPacks) Hash() flow.Identifier
- func (c *ChunkDataPacks) Rem(chunkID flow.Identifier) bool
- func (c *ChunkDataPacks) Size() uint
- type Collections
- type EjectFunc
- type Guarantees
- type IdentifierMap
- func (i *IdentifierMap) Append(key, id flow.Identifier) error
- func (i *IdentifierMap) Get(key flow.Identifier) ([]flow.Identifier, bool)
- func (i *IdentifierMap) Has(key flow.Identifier) bool
- func (i *IdentifierMap) Keys() ([]flow.Identifier, bool)
- func (i *IdentifierMap) Rem(key flow.Identifier) bool
- func (i *IdentifierMap) RemIdFromKey(key, id flow.Identifier) error
- func (i *IdentifierMap) Size() uint
- type Identifiers
- type IncorporatedResultSeals
- func (ir *IncorporatedResultSeals) Add(seal *flow.IncorporatedResultSeal) (bool, error)
- func (ir *IncorporatedResultSeals) All() []*flow.IncorporatedResultSeal
- func (ir *IncorporatedResultSeals) ByID(id flow.Identifier) (*flow.IncorporatedResultSeal, bool)
- func (ir *IncorporatedResultSeals) Clear()
- func (ir *IncorporatedResultSeals) RegisterEjectionCallbacks(callbacks ...mempool.OnEjection)
- func (ir *IncorporatedResultSeals) Rem(id flow.Identifier) bool
- type IncorporatedResults
- func (ir *IncorporatedResults) Add(incorporatedResult *flow.IncorporatedResult) (bool, error)
- func (ir *IncorporatedResults) All() []*flow.IncorporatedResult
- func (ir *IncorporatedResults) ByResultID(resultID flow.Identifier) (*flow.ExecutionResult, map[flow.Identifier]*flow.IncorporatedResult, bool)
- func (ir *IncorporatedResults) Rem(incorporatedResult *flow.IncorporatedResult) bool
- func (ir *IncorporatedResults) Size() uint
- type LRUEjector
- type OptionFunc
- type Queues
- type QueuesBackdata
- type ReceiptDataPacks
- func (r *ReceiptDataPacks) Add(rdp *verification.ReceiptDataPack) bool
- func (r *ReceiptDataPacks) All() []*verification.ReceiptDataPack
- func (r *ReceiptDataPacks) Get(rdpID flow.Identifier) (*verification.ReceiptDataPack, bool)
- func (r *ReceiptDataPacks) Rem(rdpID flow.Identifier) bool
- func (r *ReceiptDataPacks) Size() uint
- type Receipts
- type ResultDataPacks
- func (r *ResultDataPacks) Add(rdp *verification.ResultDataPack) bool
- func (r *ResultDataPacks) Get(rdpID flow.Identifier) (*verification.ResultDataPack, bool)
- func (r *ResultDataPacks) Has(rdpID flow.Identifier) bool
- func (r *ResultDataPacks) Rem(rdpID flow.Identifier) bool
- func (r *ResultDataPacks) Size() uint
- type Results
- type Time
- type Times
- type TransactionTimings
- func (t *TransactionTimings) Add(tx *flow.TransactionTiming) bool
- func (t *TransactionTimings) Adjust(txID flow.Identifier, f func(*flow.TransactionTiming) *flow.TransactionTiming) (*flow.TransactionTiming, bool)
- func (t *TransactionTimings) All() []*flow.TransactionTiming
- func (t *TransactionTimings) ByID(txID flow.Identifier) (*flow.TransactionTiming, bool)
- func (t *TransactionTimings) Rem(txID flow.Identifier) bool
- type Transactions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EjectFakeRandom ¶
func EjectFakeRandom(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
EjectFakeRandom relies on the random map iteration in Go to pick the entity we eject from the entity set. It picks the first entity upon iteration, thus being the fastest way to pick an entity to be evicted; at the same time, it conserves the random bias of the Go map iteration.
func EjectPanic ¶
func EjectPanic(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
EjectPanic simply panics, crashing the program. Useful when cache is not expected to grow beyond certain limits, but ejecting is not applicable
func EjectTrueRandom ¶
func EjectTrueRandom(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
EjectTrueRandom relies on a random generator to pick a random entity to eject from the entity set. It will, on average, iterate through half the entities of the set. However, it provides us with a truly evenly distributed random selection.
Types ¶
type Approvals ¶
type Approvals struct {
// contains filtered or unexported fields
}
Approvals implements the result approvals memory pool of the consensus nodes, used to store result approvals and to generate block seals. Approvals are indexed by chunk and approver to facilitate the chunk-matching algorithm. The underyling key value store is as follows:
[chunk_key] => ( [approver_id] => *ResultApproval )
where chunk_key is an identifier obtained by combining the approval's result ID and chunk index.
func NewApprovals ¶
func NewApprovals(limit uint, opts ...OptionFunc) (*Approvals, error)
NewApprovals creates a new memory pool for result approvals.
func (*Approvals) Add ¶
func (a *Approvals) Add(approval *flow.ResultApproval) (bool, error)
Add adds a result approval to the mempool.
func (*Approvals) All ¶
func (a *Approvals) All() []*flow.ResultApproval
All will return all approvals in the memory pool.
func (*Approvals) ByChunk ¶ added in v0.9.6
func (a *Approvals) ByChunk(resultID flow.Identifier, chunkIndex uint64) map[flow.Identifier]*flow.ResultApproval
Get fetches approvals for a specific chunk
func (*Approvals) RemApproval ¶ added in v0.11.0
func (a *Approvals) RemApproval(approval *flow.ResultApproval) (bool, error)
RemApproval removes a specific approval.
type Assignments ¶
type Assignments struct {
*Backend
}
Assignments implements the chunk assignment memory pool.
func NewAssignments ¶
func NewAssignments(limit uint) (*Assignments, error)
NewAssignments creates a new memory pool for Assignments.
func (*Assignments) Add ¶
func (a *Assignments) Add(fingerprint flow.Identifier, assignment *chunkmodels.Assignment) bool
Add adds an Assignment to the mempool.
func (*Assignments) All ¶
func (a *Assignments) All() []*chunkmodels.Assignment
All returns all chunk data packs from the pool.
func (*Assignments) ByID ¶
func (a *Assignments) ByID(assignmentID flow.Identifier) (*chunkmodels.Assignment, bool)
ByID retrieves the chunk assignment from mempool based on provided ID
func (*Assignments) Has ¶
func (a *Assignments) Has(assignmentID flow.Identifier) bool
Has checks whether the Assignment with the given hash is currently in the memory pool.
func (*Assignments) Rem ¶
func (a *Assignments) Rem(assignmentID flow.Identifier) bool
Rem will remove the given Assignment from the memory pool; it will return true if the Assignment was known and removed.
func (*Assignments) Size ¶
func (a *Assignments) Size() uint
Size will return the current size of the memory pool.
type Backdata ¶
type Backdata struct {
// contains filtered or unexported fields
}
Backdata implements a generic memory pool backed by a Go map.
func NewBackdata ¶
func NewBackdata() Backdata
func (*Backdata) Adjust ¶
func (b *Backdata) Adjust(entityID flow.Identifier, f func(flow.Entity) flow.Entity) (flow.Entity, bool)
Adjust will adjust the value item using the given function if the given key can be found. Returns a bool which indicates whether the value was updated as well as the updated value
func (*Backdata) Clear ¶ added in v0.11.0
func (b *Backdata) Clear()
Clear removes all entities from the pool.
func (*Backdata) Has ¶
func (b *Backdata) Has(entityID flow.Identifier) bool
Has checks if we already contain the item with the given hash.
func (*Backdata) Hash ¶
func (b *Backdata) Hash() flow.Identifier
Hash will use a merkle root hash to hash all items.
type Backend ¶
Backend provides synchronized access to a backdata
func NewBackend ¶
func NewBackend(options ...OptionFunc) *Backend
NewBackend creates a new memory pool backend.
func (*Backend) Adjust ¶
func (b *Backend) Adjust(entityID flow.Identifier, f func(flow.Entity) flow.Entity) (flow.Entity, bool)
Adjust will adjust the value item using the given function if the given key can be found. Returns a bool which indicates whether the value was updated.
func (*Backend) Clear ¶ added in v0.11.0
func (b *Backend) Clear()
Clear removes all entities from the pool.
func (*Backend) Has ¶
func (b *Backend) Has(entityID flow.Identifier) bool
Has checks if we already contain the item with the given hash.
func (*Backend) Hash ¶
func (b *Backend) Hash() flow.Identifier
Hash will use a merkle root hash to hash all items.
func (*Backend) RegisterEjectionCallbacks ¶ added in v0.13.0
func (b *Backend) RegisterEjectionCallbacks(callbacks ...mempool.OnEjection)
RegisterEjectionCallbacks adds the provided OnEjection callbacks
func (*Backend) Rem ¶
func (b *Backend) Rem(entityID flow.Identifier) bool
Rem will remove the item with the given hash.
type BlockByCollectionBackdata ¶
type BlockByCollectionBackdata struct {
*Backdata
}
BlockByCollectionBackdata contains all the collections is being requested, for each collection it stores the blocks that contains the collection. the Backdata is essentially map<collectionID>map<blockID>*ExecutableBlock
func (*BlockByCollectionBackdata) ByID ¶
func (b *BlockByCollectionBackdata) ByID(id flow.Identifier) (*entity.BlocksByCollection, bool)
type BlockByCollections ¶
type BlockByCollections struct {
*Backend
}
Hold all the missing collections. Each entry is a missing collection, and all the blocks that contain this collection
func NewBlockByCollections ¶
func NewBlockByCollections() *BlockByCollections
func (*BlockByCollections) Add ¶
func (b *BlockByCollections) Add(block *entity.BlocksByCollection) bool
func (*BlockByCollections) Get ¶
func (b *BlockByCollections) Get(collID flow.Identifier) (*entity.BlocksByCollection, bool)
func (*BlockByCollections) Run ¶
func (b *BlockByCollections) Run(f func(backdata *BlockByCollectionBackdata) error) error
type Blocks ¶
type Blocks struct {
*Backend
}
Blocks implements the blocks memory pool.
type ChunkDataPacks ¶
type ChunkDataPacks struct {
*Backend
}
ChunkDataPacks implements the ChunkDataPack memory pool.
func NewChunkDataPacks ¶
func NewChunkDataPacks(limit uint) (*ChunkDataPacks, error)
NewChunkDataPacks creates a new memory pool for ChunkDataPacks.
func (*ChunkDataPacks) Add ¶
func (c *ChunkDataPacks) Add(cdp *flow.ChunkDataPack) bool
Add adds an chunkDataPack to the mempool.
func (*ChunkDataPacks) All ¶
func (c *ChunkDataPacks) All() []*flow.ChunkDataPack
All returns all chunk data packs from the pool.
func (*ChunkDataPacks) ByChunkID ¶
func (c *ChunkDataPacks) ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPack, bool)
ByChunkID returns the chunk data pack with the given chunkID from the mempool.
func (*ChunkDataPacks) Has ¶
func (c *ChunkDataPacks) Has(chunkID flow.Identifier) bool
Has checks whether the ChunkDataPack with the given chunkID is currently in the memory pool.
func (*ChunkDataPacks) Hash ¶
func (c *ChunkDataPacks) Hash() flow.Identifier
Hash will return a hash of the contents of the memory pool.
func (*ChunkDataPacks) Rem ¶
func (c *ChunkDataPacks) Rem(chunkID flow.Identifier) bool
Rem will remove chunk data pack by ID
func (*ChunkDataPacks) Size ¶
func (c *ChunkDataPacks) Size() uint
Size will return the current size of the memory pool.
type Collections ¶
type Collections struct {
*Backend
}
Collections implements a mempool storing collections.
func NewCollections ¶
func NewCollections(limit uint) (*Collections, error)
NewCollections creates a new memory pool for collection.
func (*Collections) Add ¶
func (c *Collections) Add(coll *flow.Collection) bool
Add adds a collection to the mempool.
func (*Collections) All ¶
func (c *Collections) All() []*flow.Collection
All returns all collections from the mempool.
func (*Collections) ByID ¶
func (c *Collections) ByID(collID flow.Identifier) (*flow.Collection, bool)
ByID returns the collection with the given ID from the mempool.
func (*Collections) Rem ¶
func (c *Collections) Rem(collID flow.Identifier) bool
Rem removes a collection by ID from memory
type EjectFunc ¶
type EjectFunc func(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
EjectFunc is a function used to pick an entity to evict from the memory pool backend when it overflows its limit. A custom eject function can be injected into the memory pool upon creation, which allows us to hook into the eject to clean up auxiliary data and/or to change the strategy of eviction.
type Guarantees ¶
type Guarantees struct {
*Backend
}
Guarantees implements the collections memory pool of the consensus nodes, used to store collection guarantees and to generate block payloads.
func NewGuarantees ¶
func NewGuarantees(limit uint) (*Guarantees, error)
NewGuarantees creates a new memory pool for collection guarantees.
func (*Guarantees) Add ¶
func (g *Guarantees) Add(guarantee *flow.CollectionGuarantee) bool
Add adds a collection guarantee guarantee to the mempool.
func (*Guarantees) All ¶
func (g *Guarantees) All() []*flow.CollectionGuarantee
All returns all collection guarantees from the mempool.
func (*Guarantees) ByID ¶
func (g *Guarantees) ByID(collID flow.Identifier) (*flow.CollectionGuarantee, bool)
ByID returns the collection guarantee with the given ID from the mempool.
type IdentifierMap ¶
type IdentifierMap struct {
*Backend
}
IdentifierMap represents a concurrency-safe memory pool for IdMapEntity.
func NewIdentifierMap ¶
func NewIdentifierMap(limit uint) (*IdentifierMap, error)
NewIdentifierMap creates a new memory pool for IdMapEntity.
func (*IdentifierMap) Append ¶
func (i *IdentifierMap) Append(key, id flow.Identifier) error
Append will append the id to the list of identifiers associated with key.
func (*IdentifierMap) Get ¶
func (i *IdentifierMap) Get(key flow.Identifier) ([]flow.Identifier, bool)
Get returns list of all identifiers associated with key and true, if the key exists in the mempool. Otherwise it returns nil and false.
func (*IdentifierMap) Has ¶
func (i *IdentifierMap) Has(key flow.Identifier) bool
Has returns true if the key exists in the map, i.e., there is at least an id attached to it.
func (*IdentifierMap) Keys ¶
func (i *IdentifierMap) Keys() ([]flow.Identifier, bool)
Keys returns a list of all keys in the mempool
func (*IdentifierMap) Rem ¶
func (i *IdentifierMap) Rem(key flow.Identifier) bool
Rem removes the given key with all associated identifiers.
func (*IdentifierMap) RemIdFromKey ¶
func (i *IdentifierMap) RemIdFromKey(key, id flow.Identifier) error
RemIdFromKey removes the id from the list of identifiers associated with key. If the list becomes empty, it also removes the key from the map.
func (*IdentifierMap) Size ¶
func (i *IdentifierMap) Size() uint
Size returns number of IdMapEntities in mempool
type Identifiers ¶
type Identifiers struct {
*Backend
}
Identifiers represents a concurrency-safe memory pool for IDs.
func NewIdentifiers ¶
func NewIdentifiers(limit uint) (*Identifiers, error)
NewIdentifiers creates a new memory pool for identifiers.
func (*Identifiers) Add ¶
func (i *Identifiers) Add(id flow.Identifier) bool
Add will add the given identifier to the memory pool or it will error if the identifier is already in the memory pool.
func (*Identifiers) All ¶
func (i *Identifiers) All() flow.IdentifierList
All returns all identifiers stored in the mempool
func (*Identifiers) Has ¶
func (i *Identifiers) Has(id flow.Identifier) bool
Has checks whether the mempool has the identifier
func (*Identifiers) Rem ¶
func (i *Identifiers) Rem(id flow.Identifier) bool
Rem removes the given identifier from the memory pool; it will return true if the identifier was known and removed.
type IncorporatedResultSeals ¶ added in v0.11.0
type IncorporatedResultSeals struct {
*Backend
}
IncorporatedResultSeals implements the incorporated result seals memory pool of the consensus nodes, used to store seals that need to be added to blocks.
func NewIncorporatedResultSeals ¶ added in v0.11.0
func NewIncorporatedResultSeals(opts ...OptionFunc) *IncorporatedResultSeals
NewIncorporatedResults creates a mempool for the incorporated result seals
func (*IncorporatedResultSeals) Add ¶ added in v0.11.0
func (ir *IncorporatedResultSeals) Add(seal *flow.IncorporatedResultSeal) (bool, error)
Add adds an IncorporatedResultSeal to the mempool
func (*IncorporatedResultSeals) All ¶ added in v0.11.0
func (ir *IncorporatedResultSeals) All() []*flow.IncorporatedResultSeal
All returns all the items in the mempool
func (*IncorporatedResultSeals) ByID ¶ added in v0.11.0
func (ir *IncorporatedResultSeals) ByID(id flow.Identifier) (*flow.IncorporatedResultSeal, bool)
ByID gets an IncorporatedResultSeal by ID
func (*IncorporatedResultSeals) Clear ¶ added in v0.13.0
func (ir *IncorporatedResultSeals) Clear()
Clear removes all entities from the pool.
func (*IncorporatedResultSeals) RegisterEjectionCallbacks ¶ added in v0.13.0
func (ir *IncorporatedResultSeals) RegisterEjectionCallbacks(callbacks ...mempool.OnEjection)
RegisterEjectionCallbacks adds the provided OnEjection callbacks
func (*IncorporatedResultSeals) Rem ¶ added in v0.11.0
func (ir *IncorporatedResultSeals) Rem(id flow.Identifier) bool
Rem removes an IncorporatedResultSeal from the mempool
type IncorporatedResults ¶ added in v0.11.0
type IncorporatedResults struct {
// contains filtered or unexported fields
}
IncorporatedResults implements the incorporated results memory pool of the consensus nodes, used to store results that need to be sealed.
func NewIncorporatedResults ¶ added in v0.11.0
func NewIncorporatedResults(limit uint, opts ...OptionFunc) (*IncorporatedResults, error)
NewIncorporatedResults creates a mempool for the incorporated results.
func (*IncorporatedResults) Add ¶ added in v0.11.0
func (ir *IncorporatedResults) Add(incorporatedResult *flow.IncorporatedResult) (bool, error)
Add adds an IncorporatedResult to the mempool.
func (*IncorporatedResults) All ¶ added in v0.11.0
func (ir *IncorporatedResults) All() []*flow.IncorporatedResult
All returns all the items in the mempool.
func (*IncorporatedResults) ByResultID ¶ added in v0.11.0
func (ir *IncorporatedResults) ByResultID(resultID flow.Identifier) (*flow.ExecutionResult, map[flow.Identifier]*flow.IncorporatedResult, bool)
ByResultID returns all the IncorporatedResults that contain a specific ExecutionResult, indexed by IncorporatedBlockID.
func (*IncorporatedResults) Rem ¶ added in v0.11.0
func (ir *IncorporatedResults) Rem(incorporatedResult *flow.IncorporatedResult) bool
Rem removes an IncorporatedResult from the mempool.
func (*IncorporatedResults) Size ¶ added in v0.11.0
func (ir *IncorporatedResults) Size() uint
Size returns the number of incorporated results in the mempool.
type LRUEjector ¶
LRUEjector provides a swift FIFO ejection functionality
func NewLRUEjector ¶
func NewLRUEjector() *LRUEjector
func (*LRUEjector) Eject ¶
func (q *LRUEjector) Eject(entities map[flow.Identifier]flow.Entity) (flow.Identifier, flow.Entity)
Eject implements EjectFunc for LRUEjector. It finds the entity with the lowest sequence number (i.e., the oldest entity). It also untracks
func (*LRUEjector) Track ¶
func (q *LRUEjector) Track(entityID flow.Identifier)
Track should be called every time a new entity is added to the mempool. It tracks the entity for later ejection.
func (*LRUEjector) Untrack ¶
func (q *LRUEjector) Untrack(entityID flow.Identifier)
Untrack simply removes the tracker of the ejector off the entityID
type OptionFunc ¶
type OptionFunc func(*Backend)
OptionFunc is a function that can be provided to the backend on creation in order to set a certain custom option.
func WithEject ¶
func WithEject(eject EjectFunc) OptionFunc
WithEject can be provided to the backend on creation in order to set a custom eject function to pick the entity to be evicted upon overflow, as well as hooking into it for additional cleanup work.
func WithLimit ¶
func WithLimit(limit uint) OptionFunc
WithLimit can be provided to the backend on creation in order to set a custom maximum limit of entities in the memory pool.
type QueuesBackdata ¶
type QueuesBackdata struct {
*Backdata
}
QueuesBackdata is mempool map for ingestion.Queues (head Node ID -> Queues)
func (*QueuesBackdata) All ¶
func (b *QueuesBackdata) All() []*queue.Queue
func (*QueuesBackdata) ByID ¶
func (b *QueuesBackdata) ByID(queueID flow.Identifier) (*queue.Queue, bool)
type ReceiptDataPacks ¶
type ReceiptDataPacks struct { *Backend // contains filtered or unexported fields }
ReceiptDataPacks implements the ReceiptDataPack mempool. ReceiptDataPacks has an LRU ejector, i.e., it evicts the oldest entity if it gets full.
func NewReceiptDataPacks ¶
func NewReceiptDataPacks(limit uint) (*ReceiptDataPacks, error)
NewReceipts creates a new memory pool for execution receipts.
func (*ReceiptDataPacks) Add ¶
func (r *ReceiptDataPacks) Add(rdp *verification.ReceiptDataPack) bool
Add will add the given ReceiptDataPack to the memory pool. It will return false if it was already in the mempool.
func (*ReceiptDataPacks) All ¶
func (r *ReceiptDataPacks) All() []*verification.ReceiptDataPack
All will return all ReceiptDataPacks in the mempool.
func (*ReceiptDataPacks) Get ¶
func (r *ReceiptDataPacks) Get(rdpID flow.Identifier) (*verification.ReceiptDataPack, bool)
Get returns the ReceiptDataPack and true, if the ReceiptDataPack is in the mempool. Otherwise, it returns nil and false.
func (*ReceiptDataPacks) Rem ¶
func (r *ReceiptDataPacks) Rem(rdpID flow.Identifier) bool
Rem removes a ReceiptDataPack by ID.
func (*ReceiptDataPacks) Size ¶
func (r *ReceiptDataPacks) Size() uint
Size returns total number ReceiptDataPacks in mempool
type Receipts ¶
type Receipts struct {
*Backend
}
Receipts implements the execution receipts memory pool of the consensus node, used to store execution receipts and to generate block seals.
func NewReceipts ¶
NewReceipts creates a new memory pool for execution receipts.
func (*Receipts) Add ¶
func (r *Receipts) Add(receipt *flow.ExecutionReceipt) bool
Add adds an execution receipt to the mempool.
func (*Receipts) All ¶
func (r *Receipts) All() []*flow.ExecutionReceipt
All will return all execution receipts in the memory pool.
func (*Receipts) ByID ¶
func (r *Receipts) ByID(receiptID flow.Identifier) (*flow.ExecutionReceipt, bool)
ByID will retrieve an approval by ID.
type ResultDataPacks ¶
type ResultDataPacks struct { *Backend // contains filtered or unexported fields }
ResultDataPacks implements the ResultDataPacks mempool interface. ResultDataPacks has an LRU ejector, i.e., it evicts the oldest entity if it gets full.
func NewResultDataPacks ¶
func NewResultDataPacks(limit uint) *ResultDataPacks
NewResultDataPacks creates a new mempool for execution results. The mempool has a FIFO ejector.
func (*ResultDataPacks) Add ¶
func (r *ResultDataPacks) Add(rdp *verification.ResultDataPack) bool
Add will add the given ResultDataPacks to the mempool. It will return false if it was already in the mempool.
func (*ResultDataPacks) Get ¶
func (r *ResultDataPacks) Get(rdpID flow.Identifier) (*verification.ResultDataPack, bool)
Get returns the ResultDataPacks and true, if the ResultDataPacks is in the mempool. Otherwise, it returns nil and false.
func (*ResultDataPacks) Has ¶
func (r *ResultDataPacks) Has(rdpID flow.Identifier) bool
Has returns true if a ResultDataPacks with the specified identifier exists.
func (*ResultDataPacks) Rem ¶
func (r *ResultDataPacks) Rem(rdpID flow.Identifier) bool
Rem removes a ResultDataPacks by identifier.
func (*ResultDataPacks) Size ¶
func (r *ResultDataPacks) Size() uint
Size returns total number ResultDataPacks in mempool
type Results ¶
type Results struct {
*Backend
}
Results implements the execution results memory pool of the consensus node, used to store execution results and to generate block seals.
func NewResults ¶
NewResults creates a new memory pool for execution results.
func (*Results) Add ¶
func (r *Results) Add(result *flow.ExecutionResult) bool
Add adds an execution result to the mempool.
func (*Results) All ¶
func (r *Results) All() []*flow.ExecutionResult
All will return all execution results in the memory pool.
func (*Results) ByID ¶
func (r *Results) ByID(resultID flow.Identifier) (*flow.ExecutionResult, bool)
ByID will retrieve an approval by ID.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
func (*Time) Checksum ¶
func (t *Time) Checksum() flow.Identifier
func (*Time) ID ¶
func (t *Time) ID() flow.Identifier
type Times ¶
type Times struct {
*Backend
}
Times implements the times memory pool used to store time.Times for an idetifier to track transaction metrics in access nodes
type TransactionTimings ¶
type TransactionTimings struct {
*Backend
}
TransactionTimings implements the transaction timings memory pool of access nodes, used to store transaction timings to report the timing of individual transactions
func NewTransactionTimings ¶
func NewTransactionTimings(limit uint) (*TransactionTimings, error)
NewTransactionTimings creates a new memory pool for transaction timings
func (*TransactionTimings) Add ¶
func (t *TransactionTimings) Add(tx *flow.TransactionTiming) bool
Add adds a transaction timing to the mempool.
func (*TransactionTimings) Adjust ¶
func (t *TransactionTimings) Adjust(txID flow.Identifier, f func(*flow.TransactionTiming) *flow.TransactionTiming) ( *flow.TransactionTiming, bool)
Adjust will adjust the transaction timing using the given function if the given key can be found. Returns a bool which indicates whether the value was updated as well as the updated value.
func (*TransactionTimings) All ¶
func (t *TransactionTimings) All() []*flow.TransactionTiming
All returns all transaction timings from the mempool.
func (*TransactionTimings) ByID ¶
func (t *TransactionTimings) ByID(txID flow.Identifier) (*flow.TransactionTiming, bool)
ByID returns the transaction timing with the given ID from the mempool.
func (*TransactionTimings) Rem ¶
func (t *TransactionTimings) Rem(txID flow.Identifier) bool
Rem removes the transaction timing with the given ID.
type Transactions ¶
type Transactions struct {
*Backend
}
Transactions implements the transactions memory pool of the consensus nodes, used to store transactions and to generate block payloads.
func NewTransactions ¶
func NewTransactions(limit uint) *Transactions
NewTransactions creates a new memory pool for transctions.
func (*Transactions) Add ¶
func (t *Transactions) Add(tx *flow.TransactionBody) bool
Add adds a transaction to the mempool.
func (*Transactions) All ¶
func (t *Transactions) All() []*flow.TransactionBody
All returns all transactions from the mempool.
func (*Transactions) ByID ¶
func (t *Transactions) ByID(txID flow.Identifier) (*flow.TransactionBody, bool)
ByID returns the transaction with the given ID from the mempool.
Source Files ¶
- approvals.go
- assignments.go
- backend.go
- blockbycollections.go
- blocks.go
- chunk_data_packs.go
- collections.go
- eject.go
- guarantees.go
- identifier_map.go
- identifiers.go
- incorporated_result_seals.go
- incorporated_results.go
- options.go
- queues.go
- receipt_data_packs.go
- receipts.go
- result_data_packs.go
- results.go
- times.go
- transaction_timings.go
- transactions.go