package
0.38.0-preview.0
Repository: https://github.com/onflow/flow-go.git
Documentation: pkg.go.dev

# README

The mempool module

The mempool module provides mempool implementations for the Flow blockchain, which are in-memory data structures that are tasked with storing the flow.Entity objects. flow.Entity objects are the fundamental data model of the Flow blockchain, and every Flow primitives such as transactions, blocks, and collections are represented as flow.Entity objects.

Each mempool implementation is tasked for storing a specific type of flow.Entity. As a convention, all mempools are built on top of the stdmap.Backend struct, which provides a thread-safe cache implementation for storing and retrieving flow.Entity objects. The primary responsibility of the stdmap.Backend struct is to provide thread-safety for its underlying data model (i.e., mempool.Backdata) that is tasked with maintaining the actual flow.Entity objects.

At the moment, the mempool module provides two implementations for the mempool.Backdata:

  • backdata.Backdata: a map implementation for storing flow.Entity objects using native Go maps.
  • herocache.Cache: a cache implementation for storing flow.Entity objects, which is a heap-optimized cache implementation that is aims on minimizing the memory footprint of the mempool on the heap and reducing the GC pressure.

Note-1: by design the mempool.Backdata interface is not thread-safe. Therefore, it is the responsibility of the stdmap.Backend struct to provide thread-safety for its underlying mempool.Backdata implementation.

Note-2: The herocache.Cache implementation is several orders of magnitude faster than the backdata.Backdata on high-throughput workloads. For the read or write-heavy workloads, the herocache.Cache implementation is recommended as the underlying mempool.Backdata implementation.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

ExponentialUpdater is a chunk request history updater factory that updates the retryAfter value of a request to multiplier * retryAfter.
IncrementalAttemptUpdater is a chunk request history updater factory that increments the attempt field of request status and makes it instantly available against any retryAfter qualifier.
IsBelowPrunedThresholdError returns whether the given error is an BelowPrunedThresholdError error.
IsUnknownExecutionResultError returns whether the given error is an UnknownExecutionResultError error.
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author

# Structs

BelowPrunedThresholdError indicates that we are attempting to query or prune a mempool by a key (typically block height or block view) which is lower than the lowest retained key threshold.
ChunkDataPackRequest is an internal data type for Execution Nodes that represents a request for a chunk data pack.
IpRecord represents the data model for maintaining an ip dns record in cache.
TxtRecord represents the data model for maintaining a txt dns record in cache.
UnknownExecutionResultError indicates that the Execution Result is unknown.

# Interfaces

Assignments represents a concurrency-safe memory pool for chunk assignments.
BackData represents the underlying data structure that is utilized by mempool.Backend, as the core structure of maintaining data on memory-pools.
Blocks represents a concurrency-safe memory pool for blocks.
ChunkDataPacks represents a concurrency-safe memory pool for chunk data packs.
ChunkRequests is an in-memory storage for maintaining chunk data pack requests.
ChunkStatuses is an in-memory storage for maintaining the chunk status data objects.
Collections represents a concurrency-safe memory pool for collections.
DNSCache provides an in-memory cache for storing dns entries.
ExecutionData represents a concurrency-safe memory pool for BlockExecutionData.
ExecutionTree represents a concurrency-safe memory pool for execution Receipts.
Guarantees represents a concurrency-safe memory pool for collection guarantees.
IdentifierMap represents a concurrency-safe memory pool for mapping an identifier to a list of identifiers.
IncorporatedResultSeals represents a concurrency safe memory pool for incorporated result seals.
PendingReceipts stores pending receipts indexed by the id.
Results represents a concurrency-safe memory pool for execution results.
Transactions represents a concurrency-safe memory pool for transactions.
TransactionTimings represents a concurrency-safe memory pool for transaction timings.

# Type aliases

BlockFilter is used for controlling the ExecutionTree's Execution Tree search.
ChunkRequestHistoryUpdaterFunc is a function type that used by ChunkRequests mempool to perform atomic and isolated updates on the underlying chunk requests history.
OnEjection is a callback which a mempool executes on ejecting one of its elements.
ReceiptFilter is used to drop specific receipts from.