jonnify·bcs /bcs/elixir-core/relations/the-edge-is-the-relation

B2.5 · dive 1 — the edge is the relation

One relation, one owner.

Portfolio holds asset is a row keyed by a tuple of names, never an id list embedded in either endpoint. One relation kind is one system: :holds, subjects gated PRT, objects gated AST, declared at start_link. An edge is {subject, object} → props, and the pair's facts live on the edge.

Source: content/bcs2.5.md, quoting bcs_rung_2_5_check.out; the system is committed at runtimes/elixir/lib/echo_data/bcs/edge_store.ex.

The surface, exported and not. The six verbs drawn as a wall with six openings; behind it the two private indexes. Select an entry to read its exact surface.
link write, both ends gated unlink remove, both directions props the pair's facts from/2 the positions blotter to/2 the holders report degree/2 the concentration check indexes private the forward index · the reverse index · any internal shape — never exported
readout · Select an entry to read its exact surface. Six verbs and nothing else — the wall is what E1 inspects, and the dashed box is what never crosses it.
§1

The transcript

bcs_rung_2_5_check.out · verbatim · this dive reads E1 and E2
content/echo_data/runtimes/elixir/bcs_rung_2_5_check.out · verbatimfrozen
boot: the holds relation is its own system -- PRT subjects, AST objects, indexes private
E1 surface ok -- the relation's surface: link, unlink, props, from, to, degree -- and its indexes are nobody's business
E2 gates ok -- both ends gated: subject must be PRT, object must be AST -- {:error, :namespace} on either violation
E3 retire ok -- the interim representation retired: positions struck out of the balance row and copied down as edges -- the 2.2 label is paid
E4 traverse ok -- forward 200 ascending with a 10-edge page head; reverse finds all 50 holders, ascending
E5 unlink ok -- unlink removes both directions atomically: degree 199; the reverse index no longer lists the subject
PASS 5/5
§2

E1 — the surface, gated a third time

content/bcs2.5.md · What · Who

E1 performs the review gate the part now runs by habit: link, unlink, props, from, to, degree -- and its indexes are nobody's business. The reverse index exists — the system maintains it — and no export names it; reverse traversal is a verb (to/2), not a table. Exporting the reverse table would hand callers a representation and start the coupling clock; the system owns its indexes, and the boundary stays six verbs wide.

The desk's three joins, by verb: the positions blotter is from/2, the holders report is to/2, the concentration check is degree/2 — three joins that were a scan, a denormalization, and a batch job in the embedded world. Risk asks exposure through the boundary instead of reading anyone's rows. And agents, for whom the contract is six verbs and one rule: a pair's facts go on the edge — the quantity of a holding belongs to the holding, not to the portfolio and not to the instrument.

§3

E2 — both ends gated

content/bcs2.5.md · What · Where

E2 closes the silent join at both doors: an ORD subject is refused, a PRT object is refused, each with {:error, :namespace} — the first relation in the series where two namespaces are checked per write, because a relation is the place wrong-kind pairs would otherwise be minted. The supervisor composes the store like any other — a {name, relation, subject_ns, object_ns} child among children; the two admitted kinds are declared at start_link and checked at every link.

The both-ends gate, exercised. A pure model of the double gate on the :holds store, whose declared pair is PRT subjects and AST objects. Select a subject kind and an object kind; the readout names the verdict.
readout · Select a subject kind and an object kind. The model runs the same two checks the committed store runs at every write: subject must be PRT, object must be AST — {:error, :namespace} on either violation.

Static verdicts — PRT → AST → admitted, the edge written into both indexes · ORD subject → {:error, :namespace} (the rung's recorded subject refusal) · PRT object → {:error, :namespace} (the rung's recorded object refusal) · both wrong → {:error, :namespace} — either violation refuses, and the write never reaches a table.

§4

References

sources · related

Sources

Related