# `Lockstep.Model.Register`
[🔗](https://github.com/b-erdem/lockstep/blob/v0.1.0/lib/lockstep/model/register.ex#L1)

Single-cell register model: read, write, and compare-and-swap.

Operations:

  * `:read` — invoke value `nil` (no args). Completion `value` is
    the value the system claims to have read. Valid iff equal to
    the model's current state.
  * `:write` — invoke value is the value to write. Completion `:ok`
    means the model's state becomes that value. Completion `:fail`
    / `:info` means the state may or may not have changed (the
    checker's job to handle).
  * `:cas` — invoke value is `{expected, new}`. Completion `:ok`
    with value `true` means CAS succeeded (state was `expected`,
    now `new`). Completion `:ok` with value `false` means CAS
    failed (state wasn't `expected`, no change).

Initial state is `nil`. Treat that as "no value yet"; `:read` from
the initial state is only valid if it returns `nil`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
