jonnify·bcs /bcs/bus/the-keyspace

B3.1 · dive 1 of 3

The keyspace.

The BCS law meets the wire. Every key on the bus is born braced for the slot, branded at the builder, and declared in KEYS[] — so the key is parsed and gated before Valkey sees it.

A bus key: born braced, branded, declared. Select a part.
emq: job: {orders}one slotthe braces pick the slot — the queue lands on one node JOB0KQ8c…gatea branded JOB id, checked at the key builder redis.call( … , KEYS[1] )the key is passed in KEYS[ ] — never built inside the script body
readout · Select a part. Every EchoMQ key is born braced, branded, and declared — the key is the contract, checked before the wire.
§1

The idea

echo_mq · keyspace.ex

EchoMQ is the bus, and a bus is where the BCS law meets the wire: only branded identities and messages about them cross between systems. The discipline is in the key. Every EchoMQ key is born braced — emq:{queue}: — born branded — a JOB id gated at the key builder — and born declared — named in a Lua script’s KEYS[], never interpolated into the body. Building a key from an ARGV prefix inside a script body is exactly what this forbids — a key the script touches but never declares is invisible to the gate, so the keyspace draws every key from a total grammar instead.

The braces are a hash-slot tag. {queue} tells Valkey to place every key for one queue on the same slot, so a multi-key script touches one node and stays atomic on a cluster. The brace is not decoration; it is the difference between a script that runs and a CROSSSLOT error. The queue name is the slot, and the slot is chosen by the name.

The id inside the key is a branded JOB id, gated where the key is built, so a malformed or wrong-kind id is refused before it reaches Valkey. And every key a script reads or writes is passed in KEYS[], so the set of keys a script touches is declared and auditable, not assembled from string fragments at run time. Braced, branded, declared: the key is the contract, and the contract is checked before the wire.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related