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,
prepared once and dispatched through the Coordinator. Single-shard pipelines
commit in one Raft round-trip; cross-shard pipelines submit independent shard
groups concurrently and are not atomic across shards.
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.
@spec execute(t()) :: [term()] | FerricStore.write_error()
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 prepared
once and dispatched through Ferricstore.Transaction.Coordinator, which groups
them by shard and submits each group as one {:tx_execute} Raft entry.
Single-shard pipelines commit atomically in one Raft round-trip; cross-shard
pipelines are ordered within each shard but not atomic across shards.
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.