xotl.crdt.register – The Registers CRTDs

class xotl.crdt.register.LWWRegister(*, process: xotl.crdt.base.Process)[source]

The Last-Write-Wins Register.

If two processes set a value concurrently (as per vector clock counter) and with the same time stamp. The process with highest priority wins.

User API

set(value)[source]

Set the value of the register.

value should be an immutable object. Putting a mutable object may lead to unexpected behavior (specially if it implements an unsafe hash).

Internal CRDT API

__lshift__(other) → bool[source]

True is other wins.

other wins if:

  • its vector clock dominates ours (it descends from ours and knows even more than we do).
  • its vector clock is concurrent with ours but other is marked with a higher timestamp.
  • none of the above, but other’s process has higher priority