Pipeline accumulator for batching multiple FerricStore commands.
Used with FerricStore.pipeline/1 to batch multiple operations into a single
Raft entry per shard. Commands are accumulated in reverse order and on execute,
converted to RESP tuples and dispatched through the Coordinator. Single-shard
pipelines commit in one Raft round-trip; cross-shard pipelines use the
anchor-shard mechanism.
Results are normalized to match the FerricStore public API format (e.g.
{:ok, value} for GET, :ok for DEL) rather than raw Dispatcher values.
Usage
FerricStore.pipeline(fn pipe ->
pipe
|> FerricStore.Pipe.set("key1", "val1")
|> FerricStore.Pipe.set("key2", "val2")
|> FerricStore.Pipe.incr("counter")
end)
Summary
Functions
Adds a DEL command to the pipeline.
Executes all accumulated pipeline commands as a single batch Raft entry per shard via the Coordinator.
Adds an EXPIRE command to the pipeline.
Adds a GET command to the pipeline.
Adds an HGET command to the pipeline.
Adds an HSET command to the pipeline.
Adds an INCR command to the pipeline.
Adds an INCRBY command to the pipeline.
Adds an LPUSH command to the pipeline.
Creates a new empty pipeline.
Adds an RPUSH command to the pipeline.
Adds a SADD command to the pipeline.
Adds a SET command to the pipeline.
Adds a ZADD command to the pipeline.
Types
@type command() :: {:set, binary(), binary(), keyword()} | {:get, binary()} | {:del, binary()} | {:incr, binary()} | {:incr_by, binary(), integer()} | {:hset, binary(), map()} | {:hget, binary(), binary()} | {:lpush, binary(), [binary()]} | {:rpush, binary(), [binary()]} | {:sadd, binary(), [binary()]} | {:zadd, binary(), [{number(), binary()}]} | {:expire, binary(), non_neg_integer()}
@type t() :: %FerricStore.Pipe{commands: [command()]}
Functions
Adds a DEL command to the pipeline.
Executes all accumulated pipeline commands as a single batch Raft entry per shard via the Coordinator.
This is called internally by FerricStore.pipeline/1. Commands are converted
to RESP-style tuples and dispatched through Ferricstore.Transaction.Coordinator,
which groups them by shard and submits each group as a single {:batch} or
{:tx_execute} Raft entry. Single-shard pipelines commit in one Raft round-trip;
cross-shard pipelines use the anchor-shard mechanism.
Results are returned in the original command order.
@spec expire(t(), binary(), non_neg_integer()) :: t()
Adds an EXPIRE command to the pipeline.
Adds a GET command to the pipeline.
Adds an HGET command to the pipeline.
Adds an HSET command to the pipeline.
Adds an INCR command to the pipeline.
Adds an INCRBY command to the pipeline.
Adds an LPUSH command to the pipeline.
@spec new() :: t()
Creates a new empty pipeline.
Adds an RPUSH command to the pipeline.
Adds a SADD command to the pipeline.
Adds a SET command to the pipeline.
Adds a ZADD command to the pipeline.