Introducing Support for Move Operations in Melda CRDT
Amos Brocco
TL;DR
This work extends Melda b20, a delta-state CRDT for JSON documents, to support move operations across hierarchical structures without introducing duplicates or significant overhead. The key idea is a minimal change to the unflattening step, removing referenced objects from the delta collection after reconstruction to ensure each object is used at most once and avoiding cycles via depth-first reconstruction. The approach preserves existing properties like non-destructive array merging and tombstone-based deletions, and is validated through a multi-client evaluation showing no duplicates or losses during concurrent relocations. The contribution enhances Melda's applicability to complex, offline-first collaborative editing tasks on nested JSON data, and establishes groundwork for further benchmarking and formal verification.
Abstract
In this paper, we present an extension to Melda (a library which implements a general purpose delta state JSON CRDT) to support move operations. This enhancement relies on minimal changes to the underlying logic of the data structure, has virtually no runtime overhead and zero storage overhead compared to the original version of the library, ensuring simplicity while addressing multiple use cases. Although concurrent reordering of the elements in a list was already supported in the original version of the library, moving objects between different containers lead to undesired outcomes, namely duplicate entries. To address this problem we revisited the original approach and introduced the necessary changes to support for relocating elements within a JSON structure. We detail those changes and provide some examples.
