dominictarr / scuttlebutt

peer-to-peer replicatable data structure
Other
1.32k stars 66 forks source link

Syncing trees #34

Open marcelklehr opened 10 years ago

marcelklehr commented 10 years ago

Hello there,

are there any efforts to build a tree-like commutatively replicated data type? Do you think this is feasible?

dominictarr commented 10 years ago

yes - but it depends on what operations you want to have? adding and updating branches would be easy - if you want to be able to move a subbranch to another place, a little more tricky, but still possible.

Basically, you'd need to flatten it down so it's something like a key/value store, and implement branches as a pointer to the subtree. then you move a branch just by saying that branches[x_id].children[y_id] = true something like that, when someone updates a property on y they would just set branches[y_id][key] = value.

https://github.com/dominictarr/crdt is a little like this, but only goes one layer deep.