Revenant — SurrealQL, compiled for coordination, at the edge

Type SurrealQL → the Worker classifies & routes it to the owning shard(s), each a Durable Object running the real SurrealDB engine + rewind-replay. Coordination happens only where an invariant demands it — never a global consensus.

The distributed schema — plain SurrealQL, placement declared inline

DEFINE TABLE user    PLACEMENT BY id;                        -- sharded by record id (rendezvous hash)
DEFINE FIELD email   ON user    TYPE string UNIQUE;         -- invariant → homed at hash(email)
DEFINE TABLE account PLACEMENT BY id;
DEFINE FIELD bal     ON account TYPE number ASSERT $value >= 0;  -- invariant → enforced at commit

Live coordination map — six shards, real Cloudflare regions

Query console — type any SurrealQL, watch it route & coordinate

read · local replica (1 hop, stale) FRESH scan · all shards FRESH scoped · only 2 shards single write cross-shard dependency multi-statement (read-your-writes) RELATE (graph edge) graph traversal cross-shard txn (2PC) txn that overdraws (aborts) MOVE (migrate)
read latency, same record two ways:
placement oracle — where does a record live?

Concurrency · rewind-replay

    Two writers race the same record. The loser hits a conflict and rewind-replays locally — re-runs over the winner's value — instead of aborting. No cross-shard messages: it's one shard's own MVCC.

    Concurrency · UNIQUE across regions

    Two users in different regions claim the same email. Its uniqueness invariant lives at a single owner shard — both message it, it arbitrates: one GRANTED, one REJECTED. No gossip, no "assume free."