B2.2.3 · dive 3 of 3 · module B2.2
TTL as structure, not bookkeeping.
A bucket derived from the snowflake groups entries into time windows, so expiry drops whole buckets — O(buckets), touching no entry. The id carrying its time makes TTL structural.
The idea
echo_data · buckets.exExpiry is usually per-entry bookkeeping — a stored deadline on every row, a sweep that visits them. EchoData.Buckets removes the bookkeeping by deriving a bucket straight from the snowflake: a right shift of the id groups entries into fixed time windows, so dropping everything older than a cutoff is dropping whole buckets — an operation in the number of buckets, touching no individual entry.
The id carrying its own creation time is what makes this structural. The bucket of any id is computable, never searched for, so a fetch is a couple of map hops and an expiry is a handful of bucket deletions. Sessions, presence, rate-limit windows, ephemeral caches — anything whose lifetime is minted-less-than-X-ago — pays nothing per entry for its TTL.
Codemojex leans on this for everything short-lived. Presence and rate-limit windows live in buckets and age out by the shift; a finished round’s ephemeral state is dropped a bucket at a time, not row by row. Because the id already encodes when it was made, time-to-live stops being data the system maintains and becomes a property of where the entry sits.
The doors
the sibling coursesEchoMQ — the protocol, in depth
The bus B3 narrates, taught rung by rung: the keyspace, the Lua inventory, and the 3.0 Stream Tier — XADD, XREADGROUP, XACK — with conformance on Valkey.
Redis Patterns Applied
The substrate patterns under the bus: sorted sets, atomic Lua moves, locks, and streams — the judgement layer.
/echo-persistenceEcho Persistence — the durable floor
Beneath the volatile tiers: the Graft page engine built twice, the commit-LSN loop, and the stream archive on Tigris. Where Part I says state lives somewhere, this says where it lives durably.
References
sources · relatedSources
- King — Announcing Snowflake (2010)time-ordered ids whose key order is mint order
- Erlang/OTP — the ets modulethe ordered_set whose key order is range-queryable without a sort
- Helland — Life Beyond Distributed Transactions (CIDR 2007)durable entities a restarted system rehydrates by name
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus