# `Concord.StateMachine`
[🔗](https://github.com/gsmlg-dev/concord/blob/main/lib/concord/state_machine.ex#L1)

The Raft state machine for Concord (Version 3).

Implements the `:ra_machine` behavior to provide a replicated key-value store
with TTL support and secondary indexes.

## Correctness Guarantees

All state mutations go through `apply/3` which is a **pure function** of
(meta, command, state) → (new_state, result, effects). Time is derived from
`meta.system_time` (leader-assigned, replicated in the log), ensuring
deterministic replay across all nodes.

## State Shape

    {:concord_kv, %{
      indexes: %{name => extractor_spec},
      command_count: non_neg_integer()
    }}

ETS tables are **materialized views** rebuilt from the authoritative state
on snapshot install. They are never the source of truth.

# `apply_command`

# `query`

# `ra_query`

