jonnify·echd /echd/memory

echd — Echo on Encore · E4

The Memory — Tiers of Truth

Reads are answered from the nearest tier that can tell the truth — and coherence weighs twenty-nine bytes.

Vision · real substrate

echd speaks in the present tense over a build ladder. Every module, verb, key, and port named on this page is real; the composition into one standing platform is the vision the ladder builds.

§1

The chapter

echo_store — table.ex · coherence.ex · journal.ex

Reads are answered from the nearest tier that can tell the truth. EchoStore is a declared near-cache: the ecc:{table}:{id} keyspace, values framed version<>value, an L1 of ETS tables over the shared L2 Valkey. The L1 is :public on purpose — a hit is a caller-side lookup that never enters the owner process — and the chapter names the contrast once, precisely: BCS systems keep :private tables to enforce the gate; the cache publishes its table to serve the read path. Two disciplines, one primitive, both deliberate — naming ETS without its discipline is the banned move; always say which.

Coherence is a message about a name: twenty-nine bytes, id:version, exactly two identities and a separator. In :tracking mode the store arms RESP3 client tracking — CLIENT TRACKING ON BCAST over the table's prefix, on a dedicated push connection — and an invalidation is one :ets.delete of one L1 row; the L2 is never touched by the push. Newer-wins is decided by mint order: the snowflake in the id is the only clock the protocol needs. Beneath it all, the journal — SQLite in WAL mode, a transactional outbox — records intents and replays the writes the network dropped, deduplicated by their recorded job ids at bus admission. The workshop writes through L2, watches the push delete the row, and measures the staleness window — the paper's dial, held in one table.

§2

The read path

hover a leg
Two tiers of truth · the hit, the fill, the push, the journal · hover to read
caller reads in-process L1 · ETS :public caller-side :ets.lookup version<>value framed miss L2 · Valkey ecc:{t}:{id} SET · PX ttl invalidate — 29 bytes · id:version → :ets.delete one row RESP3 CLIENT TRACKING ON BCAST PREFIX ecc:{t}: the journal — SQLite WAL · outbox intents · replay deduplicated at bus admission
The hit — L1 public, on purpose. The table is [:set, :public, :named_table, read_concurrency], so a hit is one caller-side lookup that never serializes through the owner process. The contrast is the point: BCS keeps tables :private to enforce the gate; the cache publishes to serve the read path. Two disciplines, both deliberate.
The fill — single flight. A miss enters the owner once; concurrent callers for the same key coalesce onto one flight. The flight reads L2, falls through to the declared loader, writes L2 with a jittered TTL, and frames the value version<>value — the version is the id-shaped clock everything else compares by.
The push — a message about a name. Twenty-nine bytes: id:version. The dedicated RESP3 connection is armed with CLIENT TRACKING ON BCAST over the table's prefix; a push deletes exactly one L1 row and touches nothing else. Newer-wins by mint order — no coordinator, no clock but the id's.
The journal — what the network dropped. One SQLite file per group, WAL mode, an intents outbox recorded transactionally. Replay re-uses the recorded job ids, so bus admission deduplicates absorbed retries — the write path degrades to durable, never to silent loss.

Hover or focus a leg to read it; click to pin. Without scripting, all four read in sequence.

§3

The modules

E4.1–E4.4
E4.1

The Keyspace and the Frame

ecc-keys · the-framed-value · fetch-and-put

designed
E4.2

L1 Public, On Purpose

caller-side-reads · single-flight-fill · two-ets-disciplines

designed
E4.3

Coherence, Three Ways

tracking-on-bcast · a-message-about-a-name · newer-wins-and-the-journal

designed
E4.4

Workshop — Watch an Invalidation Land

write-through-l2 · the-push-deletes-the-row · the-staleness-window

designed

← Back to chapters

§4

Doors

the sibling courses
§5

References

sources · related

Sources

Related