Bedrock.Internal.TransactionBuilder.PointReads (bedrock v0.6.0)

View Source

Point read operations for the Transaction Builder.

This module handles single-point read operations, including regular key fetches and key selector resolution. All operations ensure proper transaction semantics with repeatable reads and conflict tracking.

Summary

Functions

Get a regular key within the transaction context.

Get a KeySelector within the transaction context.

Types

storage_get_key_fn()

@type storage_get_key_fn() :: (pid(), binary(), Bedrock.version(), keyword() ->
                           {:ok, binary()} | {:error, atom()})

storage_get_key_selector_fn()

@type storage_get_key_selector_fn() :: (pid(),
                                  Bedrock.KeySelector.t(),
                                  Bedrock.version(),
                                  keyword() ->
                                    {:ok, binary()} | {:error, atom()})

Functions

get_key(t, key, opts \\ [])

@spec get_key(
  Bedrock.Internal.TransactionBuilder.State.t(),
  key :: Bedrock.key(),
  opts :: [storage_get_key_fn: storage_get_key_fn(), snapshot: boolean()]
) ::
  {Bedrock.Internal.TransactionBuilder.State.t(),
   {:ok, {Bedrock.key(), Bedrock.value()}}
   | {:error, :not_found}
   | {:failure,
      %{
        required(
          :timeout
          | :unavailable
          | :version_too_old
          | :version_too_new
          | :no_servers_to_race
          | :layout_lookup_failed
        ) => [pid()]
      }}}

Get a regular key within the transaction context.

Expects pre-encoded keys and returns raw values.

get_key_selector(t, key_selector, opts \\ [])

@spec get_key_selector(
  Bedrock.Internal.TransactionBuilder.State.t(),
  Bedrock.KeySelector.t(),
  opts :: [{:storage_get_key_selector_fn, storage_get_key_selector_fn()}]
) ::
  {Bedrock.Internal.TransactionBuilder.State.t(),
   {:ok, Bedrock.key_value()}
   | {:error, :not_found}
   | {:failure,
      %{
        required(
          :timeout
          | :unavailable
          | :version_too_old
          | :version_too_new
          | :no_servers_to_race
          | :layout_lookup_failed
        ) => [pid()]
      }}}

Get a KeySelector within the transaction context.