B2 · module 1 of 6 · A System Is an OTP Application
A system is an OTP application.
A module whose export list is its boundary, a process that owns its state in a :private table, and a supervisor that owns the process’s existence but deliberately not its data.
Six dives: three take the shape apart — boundary, supervision tree, ownership — and three walk the real code, application.ex, supervisor.ex, and the whole of property_store.ex.
The six dives
three on the shape, three on the sourceThe boundary is the export list
A system’s public functions are its whole surface; the :private table is sealed; only an id and a message cross.
The supervision tree
A one_for_one tree over named stores; a crashed child restarts clean in isolation; let-it-crash, contained.
The supervisor owns existence, not data
The supervisor owns lifecycle; the system owns its state; a restart rehydrates from the store and the floor, by id.
B2.1.4The application boots the contract
application.ex in full: seed the Snowflake, prove the contract against the committed vector, then root the tree.
The supervisor names the systems
supervisor.ex in full: a comprehension maps {name, namespace} pairs to named, isolated children.
The property store, in full
property_store.ex in full: the export list, one :private :ordered_set, every ingress gated, placement pure.
The first three dives take the shape apart; the last three walk the committed code — application.ex, supervisor.ex, and the whole of property_store.ex.
The module, in one law
echo_data · bcs/property_store.ex, supervisor.exB2.1 reads OTP as architecture, then reads the architecture in source. A BCS system is an OTP application: a module whose export list is its boundary, a process that owns its state in a :private table, and a supervisor that owns the process’s existence but not its data. The first three dives take the shape apart; the last three walk the real code that implements it — application.ex, supervisor.ex, and the whole of property_store.ex — and point each line at the room Codemojex will supervise.
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
- Erlang/OTP — the application behaviourthe start/2 callback that boots a system's contract before it serves
- Erlang/OTP — the supervisor behaviourone_for_one over named stores: the tree that owns a system's existence
- Erlang/OTP — the gen_server behavioura system as a process: one mailbox, one private state, a message-only surface
- Erlang/OTP — the ets modulethe :private :ordered_set table a property store owns behind its boundary
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus