Kapitol World

Event-driven

Every reading, alarm and command is an event

The ledger records what moved. Everything else that happened is an event: a reading arrived, an alarm rose, a person acknowledged it, a command was sent, a device answered. All events go into one record, in order of time, shared by every world - World calls it the event spine. A world's "now" is worked out from its events. It is never kept in a field that the next writer overwrites.

A reading, and its alarm, in the same step

On the hospital ward every value comes from a device. When a reading falls outside its critical limits, the alarm is raised by the database in the same transaction - one all-or-nothing step - that stores the reading - not by a program that looks later and might miss it, or raise it twice.

From a reading to an acknowledged alarm A device reports a reading every fifteen minutes. The database stores it and, in the same step, raises one alarm if the value is outside its critical limits. While the value stays out, no second alarm rises. A nurse acknowledges the alarm, or the duty desk does after 45 minutes. Room sensor reports every 15 minutes temperature, humidity ... One transaction the reading is stored outside critical limits? then one ALERT event, now The nurse acknowledges by the nurse's own key - the event names who ... or the duty desk after 45 minutes, by its own key One alarm per outage. While a value stays outside its limits, no second alarm rises: an access point down for an hour is one alarm, not four. "Active" is derived: an alarm is active while the reading now is still outside its limits - worked out, never a flag someone forgets.
The ward at ward.kapitolworld.com lives this every day: ten to twelve alarms a day, never more than two at once. Every value is simulated.

A command's whole life

A command is not a message thrown at a device. It is a dispatch, a row with a life of its own, and every step of that life is an event on the spine. The device asks for its work every ten seconds - apart from its readings, which it sends every fifteen minutes - and moves the dispatch along.

The life of a dispatch A facility engineer sends a command: NEW. It is SENT to the device, which ACKNOWLEDGES it, reports IN PROGRESS, and finishes DONE or FAILED. Each step is an event with its time. NEW SENT ACKNOWLEDGED IN PROGRESS DONE FAILED the engineer sends PING (answer me), CALIBRTE (calibrate), INTERVAL (report more or less often), SOUND (test a siren) or REBOOT - only to a device that can do it; one open command per device and verb; unanswered for 2 minutes, it ends FAILED
On the ward a command to the wrong device is refused by the database, and one device cannot answer for another.

The same spine in every world

Every world runs its own chain of verbs on the same spine. A verb that moves money or goods writes its ledger line and its event in the same step.

WorldA day's chain of verbs
Trattoria PhoenixRESERVE a table → ORDER → FIRE to the kitchen → DELIVER by the waiter robot → BILL
Robot Product DeliverySHIP a parcel → MAPLOAD its route → LAUNCH the drone → DROP at the address
Emoji Product FactoryINGEST a design → SCREEN it (passed or failed) → BULKRUN authorized → ASSEMBLE → SELL
Southwind TradersSELL → SHIP; a correction: AMEND → PROVE → APPLY
The libraryLEND a book → RETURN it; a mistake: STORNO, with a reason
The hospital warda reading → an alarm → ACKEVENT; a command → its dispatch's life; a wrong reading: WITHDRAW or SUBST

Each verb is explained in plain words on Verbs.

"Now" is re-derived

An order's "last changed", a room's temperature now, whether an alarm is still active - each is worked out from the events, not written into a field that the next writer overwrites. That is the third clause of the ledger law, re-derive what maximizes, and it is also what let five and twenty sessions at a time add lines to one order without being turned back (see Tested).