Lesson 4 of 7 · 3 min 19 sec

What Goes in the Log

Chapters

  1. One question
  2. State and block move together
  3. What a block is good for
Transcript
Download transcript

One question

Each actor can keep a Rechain log. It is tempting to write everything into it. Don't. The log is the history of changes this actor accepted, in order. One question decides what goes in. Will someone later need to verify this, or replay it? A score: yes. A student may dispute it. An open award: yes. It changes what Mira may ask for next. An issued card: yes, that is the public record. A suspension: yes. It decides what every later request is allowed to do. The pass mark setting: no. The mark that mattered already rides inside each score. A retry of a remote step: no. That is the workflow's progress, and Takt keeps it. A delivery acknowledgement: no. That is transport, and Reactor keeps it. A timeout: no. Nobody accepted anything.

State and block move together

Look ahead to nine o'clock, inside the registry. The school has asked for Mira's card. The next lesson draws how that request travels. Here, it has arrived at its door, and the door has let it in. Two reducers share this chain. Standing owns each school's status. Cards owns every card. Dispatch sends the action to both. Standing checks its own state. Harbour is in good standing and accredited for course twelve. Cards checks its own records. This award has no card, and the next card number is free. Both reducers prepare their changes before either writes. Now both prepared changes run. Harbour's issued count goes from five to six. Valid cards go from thirty-one to thirty-two, and the new card is number forty-one. Then the chain gains block forty-one. The state and the block are one step. You never get one without the other.

What a block is good for

The registry replies with a receipt. Card forty-one was issued in registry block forty-one. That gives the school a reference to the accepted change. Anyone can ask the registry for the card's current public status. The school will write that receipt into its own log. Block one-eighteen opened Mira's award. Block one-nineteen closes it, with card forty-one inside. Two actors, two logs, each in its own order. They point at each other. They are never one chain. Now the question from the start: replay. Take the roll as it stood at block one-fifteen, and feed it the recorded actions in order. Enroll. Score, against seventy. Open award. Close award, with card forty-one. The roll is rebuilt exactly. And look at the channel. Nothing moved. The call to the registry was never in the log. Only its accepted result was.