xotl.crdt.sets – The Sets CRTDs

class xotl.crdt.sets.GSet(*, process: xotl.crdt.base.Process)[source]

The Grow-only set.

User API

add(item)[source]

Add item to the set.

class xotl.crdt.sets.TwoPhaseSet(*, process: xotl.crdt.base.Process)[source]

User API

add(item) → None[source]

Add item to the set.

remove(item) → bool[source]

Remove item to the set.

If item is not in (this replica’s view of) the set, do nothing. If it was, remove it and the item will never in the set again.

class xotl.crdt.sets.USet(*, process: xotl.crdt.base.Process)[source]

The USet.

Warning

You must be careful using this directly. You MUST never add the same item twice. This as way to implement the ORSet.

User API

add(item) → None[source]

Add item to the set.

remove(item) → None[source]

Remove item from the set.

If item is not in (this replica’s view of) the set, nothing happens.

class xotl.crdt.sets.ORSet(*, process: xotl.crdt.base.Process)[source]

The Observed-Remove Set.

User API

add(item)[source]

Add item to the set.

remove(item)[source]

Remove item from the set.

We remove the observed instances of item in this replica; if this replica hasn’t any, do nothing. This also means that an add(x) at one replica concurrent with a remove(x) at another, will result in the item being kept.