How machines catch each other up
Four ways a machine can reach the rest of the hospital, tried in order. It uses the best one available and tells you which.
3 min read
A machine never waits for the network, but it does keep trying to reach the rest of the hospital. There are four ways it can, and it tries them in order — best first.
The ladder
1. The hub. One machine in the hospital is the hub: usually the one that stays on, in the office or at reception. It holds everything every machine has done. A station reaching the hub is the normal, healthy state — it is on the hospital's own network, so it works whether or not the internet does.
2. The cloud. If the hub cannot be reached — it is off, or the switch is down — a machine goes to the cloud directly, provided there is internet.
3. A peer. If neither the hub nor the cloud can be reached, machines on the same network exchange what they have with each other. Nothing is decided by a peer; it only carries. If the consulting room learnt of a patient from the front desk and you are talking to the consulting room, you get that patient.
4. Alone. Nothing reachable. The machine keeps working on its own and queues everything it does.
The banner tells you which rung you are on: Hub, Cloud, Peers or Alone.
Nothing is ever lost on the way down
Everything a machine does is written down before it is sent, in the same breath as the work itself. If the machine is offline, it stays written down. If the machine is switched off mid-sentence, it is still written down. When a connection comes back, the queue drains.
That queue is never emptied by giving up. A write that cannot be sent stays until it is sent or refused, and a refused write turns the banner red, because waiting will not fix it — see Some writes were refused.
Nothing arrives twice
Two machines talking may well have seen the same thing already, from a third. Every recorded fact carries its own identity, so a machine that is offered something it already holds simply recognises it. You can cut the network, join it, cut it again, swap the hub and reinstall a machine, and each fact still lands exactly once.
This is the property the whole design rests on, so it is not taken on trust. It is tested by simulating whole hospitals — machines going down, the hub failing over, outages of a full day, a machine reinstalled from nothing — across thousands of randomised runs, and checking afterwards that every machine agrees and nothing is duplicated or missing.
If the hub goes down
The hub is a role, not a special machine. If it stops, another machine takes the role over and the hospital carries on. When the old hub comes back it learns that it is no longer the hub and catches up like anybody else.
You do not have to do anything for this to happen, and no work is lost either way.