jonnify·bcs /bcs/elixir-core/gates/the-gate

B2.6.1 · dive 1 of 3 · module B2.6

The gate admits one namespace.

Bcs.gate(id, ns) admits an id of exactly one namespace and refuses the rest — :namespace for the wrong kind, :invalid for the unparseable — adding no second parser beyond BrandedId.parse/1.

One parse, three outcomes: admitted, wrong namespace, unparseable. Select a part.
id, nsBrandedId.parsethe only classifier match ns → {:ok, snowflake}admitted other ns → :namespaceunparseable → :invalid
readout · Select a part. Bcs.gate parses with BrandedId.parse/1 alone; a matching namespace is admitted as {:ok, snowflake}; another namespace gives :namespace; an unparseable id gives :invalid.
§1

The idea

echo_data · bcs.ex

Every BCS system sits behind one function. EchoData.Bcs.gate(id, ns) parses an id once and admits it only if its namespace is the one the system declared: a match returns {:ok, snowflake}, another namespace returns {:error, :namespace}, and an unparseable id returns {:error, :invalid}. Two failure modes, named, and nothing admitted by accident.

The gate adds no second parser. Classification beyond the namespace collapses to :invalid, exactly as EchoData.BrandedId.parse/1 reports it, so there is one authority on what an id is and the gate defers to it. The property store, the edges store, the timeline — each crosses this gate before it touches a tier, which is why a malformed write is refused at the door rather than stored and discovered wrong on a read.

Codemojex puts the gate in front of every command. A move names a player and a room, and the room’s gate admits only its own kind on each end before the board is touched; an id from another namespace is turned away with :namespace, never written and never trusted. The boundary the whole course has described is, in the end, this one call.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related