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:
- Identical — same
PatchValue: idempotent, keep one copy. - Compatible — mergeable edits on the same path (e.g. both Add the
same blob via different
FileIdswould conflict, but identical Adds are idempotent per case 1). - 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:
BTreeMapiteration is deterministic.- Identical entries collapse (idempotent).
- Conflict detection is symmetric (both sides produce the same
PathConflictregardless of argument order because sides are sorted).
Structs§
- Epoch
Mismatch - Error that occurs if
joinis called on patch-sets with different base epochs. - Join
Result - The result of joining two
PatchSets. - Path
Conflict - A conflict on a single path during
join.
Enums§
- Conflict
Reason - Why two
PatchValues on the same path could not be merged.