Structure family

Sets

Replicated sets differ mainly in how they handle removal. Their merge rules preserve enough evidence to remain safe when updates are delayed, repeated, or reordered.

CRDT

GSet

An add-only set that merges by union.

g_set_kernel

A GSet can add members but cannot remove them. Merge takes the union, so repeated or reordered state does not change the result.

Best for

  • Recorded event IDs, observed devices, and permanent labels
  • Membership that must only grow
Updates
Add only
Merge rule
Set union
Metadata
One retained entry per member
Open the GSet lesson

CRDT

TwoPSet

A removable set where retirement is permanent.

two_p_set_kernel

A TwoPSet keeps separate grow-only sets for additions and removals. Removal wins permanently: after a value enters the removal set, the same value cannot be added again.

Best for

  • Revoked credentials and decommissioned equipment
  • Membership where removal must win permanently
Updates
Add once, remove once
Merge rule
Union additions and removals
Metadata
Members plus permanent tombstones
Open the TwoPSet lesson

CRDT

Observed-remove set

A removable set that permits a later or concurrent re-add.

or_set_kernel

An observed-remove set assigns a unique tag to each addition. Removal targets only observed tags, so a later or concurrent add of the same value can remain in the set.

Best for

  • Collaborative selections, tags, rosters, and carts
  • Membership that must support remove and re-add
Updates
Add, remove, and re-add
Merge rule
Union tags, then subtract observed removals
Metadata
Live addition tags plus removal knowledge
Open the observed-remove set lesson

Removal determines the set

Need Choose Cost
No item removal GSet Retain each member
Removal is permanent TwoPSet Retain every removed value
Items can return Observed-remove set Retain identities and removal knowledge