Bedrock.DataPlane.Materializer.Olivine.IntakeQueue (bedrock v0.5.2)
View SourceTransaction intake queue for batching and processing encoded transactions.
Manages a queue of {encoded_transaction, version, size} tuples with operations for adding transactions and taking batches by size limits.
Summary
Functions
Adds encoded transactions to the queue. Each transaction is stored with its version and byte size.
Returns true if the queue is empty.
Creates a new empty intake queue.
Returns the number of transactions in the queue.
Takes a batch of transactions up to the specified count limit.
Takes a batch of transactions up to the specified size limit. Always takes at least one transaction, even if it exceeds the size limit.
Types
@type t() :: %Bedrock.DataPlane.Materializer.Olivine.IntakeQueue{ queue: :queue.queue({binary(), Bedrock.version(), pos_integer()}) }
Functions
Adds encoded transactions to the queue. Each transaction is stored with its version and byte size.
Returns true if the queue is empty.
@spec new() :: t()
Creates a new empty intake queue.
@spec size(t()) :: non_neg_integer()
Returns the number of transactions in the queue.
@spec take_batch_by_count(t(), pos_integer()) :: {[binary()], Bedrock.version() | nil, t()}
Takes a batch of transactions up to the specified count limit.
Returns {batch, last_version, updated_intake_queue}.
@spec take_batch_by_size(t(), pos_integer()) :: {[binary()], Bedrock.version() | nil, t()}
Takes a batch of transactions up to the specified size limit. Always takes at least one transaction, even if it exceeds the size limit.
Returns {batch, last_version, updated_intake_queue}.