Closed DiamondYuan closed 3 years ago
3.6 Algorithm extensions of 《A highly-available move operation for replicated trees and distributed 》mention the solution
Ordering of sibling nodes. Another useful extension of the tree algorithm is to allow children of the same parent node to have an explicit ordering. For example, in XML, the set of children of an element is ordered. This can be implemented by maintaining an additional list CRDT for each branch node, e.g. using RGA [16] or Logoot [17]. These algorithms assign a unique ID to each element of the list, and this ID can be included in the metadata field of move operations in order to determine the order of sibling nodes. This approach to determining ordering also easily sup- ports reordering of child nodes within a parent: to move a node to a different position in a list, we use the list CRDT to generate a new ID at the desired position in the sequence [18]. Then we perform a move operation in which the parent node is unchanged, but the metadata is changed to this new ID.
Hi @DiamondYuan, we are planning to implement a move operation, and this is tracked in issue #319. However, I can't promise a timeline for this feature at the moment. I will close this issue as a duplicate of #319.
I am going to build a local first notion,workflowy like editor。 the data type is like
const doc = { content: 'root', children: [{ content: '1.0', children: [{ data: "1.1", children: [] }, { data: "1.2", children: [] }] }] }
type MoveListCRDT = Array
type uuid = string
type RGANode = { content: string data: MoveListCRDT;
}
now ,indent is implement by deleting and insert,will get error when concurrent moves of the same node