Structure family
Registers
The camera list is settled. Now the hikers need one answer: is the Eagle Creek trail open? Alice reports open and Bob reports closed, before either sees the other's report. The three registers below handle that in three steps: choose one answer by time, keep both answers, or let the ranger station number every version.
lww_register_kernel
Alice reports Trail open while Bob reports
Trail closed. A last-writer-wins register keeps one
value. The hikers keep the value with the later time. If the
times match, they compare the authors' names.
Carol can receive the reports in either order and still choose the same value. The losing report is discarded, so readers do not see the disagreement.
Best for
- Small settings that need one predictable answer
- Values where people trust timestamps to select one answer
- Updates
- Text with a time and author
- How copies combine
- Later time, then author
- What it remembers
- The answer, time, and author
mv_register_kernel
Neither report is safe to discard. The multi-value register keeps both Alice's and Bob's answers. Carol sees the disagreement instead of a silent winner.
After Carol inspects the bridge, her next report can replace the answers she saw. A report she has not seen still remains.
Best for
- Reviews where a person must resolve competing answers
- Values where losing a valid report would be harmful
- Updates
- Answers tagged with the answers they replace
- How copies combine
- Keep every answer that no later answer replaced
- What it remembers
- Each remaining answer and its history
register_collection_kernel
Alice and Bob submit reports before either sees the other. Here the ranger station returns: it numbers and stores both versions. One reading method keeps the first answer that had no competition. Another returns the newest numbered answer.
The collection does not compare clocks or combine the answers. It keeps the numbered versions so the reader can choose between the two rules.
Best for
- Named lines that need a first or newest answer
- Shared work where old numbered versions still matter
- Updates
- Answers numbered by the ranger station
- Read rules
- First uncontested or newest
- What it remembers
- Answers and their numbers
Choose what disagreement means
| Need | Choose | Trade-off |
|---|---|---|
| Use time to select one answer | LWWRegister | Discard the other answer |
| Keep competing answers | MvRegister | Someone must resolve them later |
| Choose from numbered answers | RegisterMap | The ranger station must number them |