jonnifyechomq

The Protocol · module 01

The owned keyspace

One module builds every key, to one braced grammar. The braces are the cluster hashtag.

The keyspace is the part of the protocol that says where. Every key EchoMQ writes is composed by EchoMQ.Keyspace to one shape — emq:{q}:<type>. The grammar is total (no key escapes the builder), the braces are the cluster hashtag that pins one queue to one slot, and the reserved base {emq}: holds the cross-queue version fence — first-byte-disjoint from any queue. Three dives read it in depth: the grammar, the slot the brace computes, and the reserve.

The keyspace in three parts

The keyspace is three things, and the three dives of this module are each one of them. Pick a part to read what it is and the real EchoMQ.Keyspace function that carries it — then take the dive.

The keyspace · pick a part

grammaremq:{q}:<type> hashtag & slot{q} → 0..16383 reserve{emq}:version one Valkey · every key built by EchoMQ.Keyspace

Three parts, one builder: the grammar says where a key lives, the hashtag says which slot it lands on, and the reserve says where the wire's own state goes — beside every queue, owned by none.

The dives

Three dives, each grounded in the real echo/apps/echo_mq keyspace module — the grammar builder, the client-side slot, and the reserved base.

built page ready to read soon on the build front

Pattern → implementation

The keyspace is one applied pattern made total. Hash-tag co-location is the move; the braced grammar is the wire that fixes it as the only way a key is built.

the pattern (Redis Patterns Applied)

Hash-tag co-location: wrap the shared part of a key in {...} so every member of a logical group routes to one cluster slot, where one atomic operation can touch them together. Redis Patterns Applied R2.05 teaches the move.

the implementation (echo_mq)

EchoMQ.Keyspace.queue_key/2 makes the brace the protocol — emq:{q}:<type> pins every key of one queue to one slot, so the Lua layer's declared-key scripts are always single-slot. The convention is total, not a style guide.

The pattern is the door; the keyspace is the wire. A naming convention becomes a protocol when one module builds every key to it — and the brace makes it cluster-correct by construction.

References

Sources

Related in this course