Skip to main content

Module join

Module join 

Source
Expand description

PatchSet join — CRDT merge of two patch-sets sharing the same base epoch.

The join operation combines two PatchSets into one by unioning their path maps. When both patch-sets touch the same path, we resolve:

  1. Identical — same PatchValue: idempotent, keep one copy.
  2. Compatible — mergeable edits on the same path (e.g. both Add the same blob via different FileIds would conflict, but identical Adds are idempotent per case 1).
  3. Conflicting — incompatible edits: emit a PathConflict.

§CRDT properties

join is:

  • Commutative: join(a, b) == join(b, a)
  • Associative: join(join(a, b), c) == join(a, join(b, c))
  • Idempotent: join(a, a) == a

These hold because:

  • BTreeMap iteration is deterministic.
  • Identical entries collapse (idempotent).
  • Conflict detection is symmetric (both sides produce the same PathConflict regardless of argument order because sides are sorted).

Structs§

EpochMismatch
Error that occurs if join is called on patch-sets with different base epochs.
JoinResult
The result of joining two PatchSets.
PathConflict
A conflict on a single path during join.

Enums§

ConflictReason
Why two PatchValues on the same path could not be merged.

Functions§

join
Join (CRDT merge) two PatchSets that share the same base epoch.