Bedrock.DataPlane.CommitProxy.Batch (bedrock v0.5.3)

View Source

Represents a batch of transactions being processed by the commit proxy.

Summary

Types

reply_fn()

@type reply_fn() :: ({:ok, Bedrock.version(), index :: non_neg_integer()}
               | {:error, :abort} ->
                 :ok)

t()

@type t() :: %Bedrock.DataPlane.CommitProxy.Batch{
  buffer: [
    {index :: non_neg_integer(), reply_fn(),
     Bedrock.DataPlane.Transaction.encoded(), Task.t() | nil}
  ],
  commit_version: Bedrock.version(),
  finalized_at: Bedrock.timestamp_in_ms() | nil,
  last_commit_version: Bedrock.version(),
  n_transactions: non_neg_integer(),
  started_at: Bedrock.timestamp_in_ms()
}

Functions

add_transaction(t, transaction, reply_fn, task)

@spec add_transaction(
  t(),
  Bedrock.DataPlane.Transaction.encoded(),
  reply_fn(),
  Task.t() | nil
) :: t()

all_callers(t)

@spec all_callers(t()) :: [reply_fn()]

new_batch(started_at, last_commit_version, commit_version)

@spec new_batch(
  Bedrock.timestamp_in_ms(),
  last_commit_version :: Bedrock.version(),
  commit_version :: Bedrock.version()
) :: t()

set_finalized_at(t, finalized_at)

@spec set_finalized_at(t(), Bedrock.timestamp_in_ms()) :: t()

transaction_count(t)

@spec transaction_count(t()) :: non_neg_integer()

transactions_in_order(t)

@spec transactions_in_order(t()) :: [
  {index :: non_neg_integer(), reply_fn(),
   Bedrock.DataPlane.Transaction.encoded(), Task.t() | nil}
]