Ferricstore.Commands.PreparedCommand (ferricstore v0.10.1)

Copy Markdown View Source

Immutable command metadata shared by parsing, authorization, and routing.

Preparation normalizes the command and arguments once. Consumers should keep this value instead of rediscovering keys from the raw command payload.

Summary

Types

shard_resolver()

@type shard_resolver() :: (binary() -> term())

t()

@type t() :: %Ferricstore.Commands.PreparedCommand{
  acl_keys: [binary()],
  args: [binary()],
  ast: term(),
  channel_keys: [binary()],
  command: binary(),
  command_keys: [binary()],
  read_keys: [binary()],
  routing_keys: [binary()],
  routing_scope: :none | :keys | :coordinated,
  transaction_mode: Ferricstore.Commands.TransactionPolicy.mode(),
  write_keys: [binary()]
}

Functions

cross_shard?(prepared_command, resolver_or_store)

@spec cross_shard?(t(), FerricStore.Instance.t() | shard_resolver()) :: boolean()

detach_retained_binaries(prepared)

@spec detach_retained_binaries(t()) :: t()

Detaches binaries that would retain a larger parent binary.

Prepared commands normally live only for one request, so preparation keeps decoder sub-binaries without copying. Long-lived consumers such as MULTI queues must call this at their retention boundary.

mutation_footprint(prepared)

@spec mutation_footprint(t()) :: %{read: [binary()], write: [binary()]}

prepare(name, args, opts \\ [])

@spec prepare(binary(), [term()], keyword()) ::
  {:ok, t()} | {:error, binary() | Ferricstore.Flow.Query.Error.t()}

shard_indexes(prepared_command, resolver)

@spec shard_indexes(t(), FerricStore.Instance.t() | shard_resolver()) :: [term()]

transaction_safe?(prepared_command)

@spec transaction_safe?(t()) :: boolean()