Ferricstore.Transaction.Coordinator (ferricstore v0.4.3)

Copy Markdown View Source

Transaction coordinator for MULTI/EXEC.

Raft-enabled transactions submit a single Raft log entry to an "anchor shard" containing commands for all involved shards. The StateMachine's apply/3 writes to all shards' ETS tables and Bitcask files in one deterministic pass. This includes single-shard write transactions; otherwise they would bypass the quorum write path and only mutate the local shard process.

WATCH conflict detection

WATCH uses per-key tokens rather than per-shard write-version counters. Hot keys include the in-memory value hash plus the live Bitcask location; cold keys snapshot the live keydir location, so large values do not have to be materialized just to enter or check WATCH.

Summary

Functions

execute(queue, watched_keys, sandbox_namespace)

@spec execute(
  [Ferricstore.Transaction.Ast.queue_entry()],
  %{required(binary()) => term()},
  binary() | nil
) :: [term()] | nil | {:error, binary()}