diff --git a/src/json-crdt-patch/PatchLog.ts b/src/json-crdt-patch/PatchLog.ts new file mode 100644 index 0000000000..d2bc3543cb --- /dev/null +++ b/src/json-crdt-patch/PatchLog.ts @@ -0,0 +1,12 @@ +import {Patch} from "@automerge/automerge"; +import {AvlMap} from "../util/trees/avl/AvlMap"; + +export class PatchLog { + /** + * Patch index by [sid, time]. + */ + private index = new AvlMap>(); + + public push(patch: Patch) {} + +} diff --git a/src/util/trees/avl/AvlMap.ts b/src/util/trees/avl/AvlMap.ts index d0b3751f12..a47856dfd1 100644 --- a/src/util/trees/avl/AvlMap.ts +++ b/src/util/trees/avl/AvlMap.ts @@ -29,6 +29,14 @@ export class AvlMap implements Printable { return item; } + /** + * Inserts a new node with the given key and value. If a node with the given + * key already exists, its value is updated. + * + * @param k Key + * @param v Value + * @returns Reference to the node with the given key. + */ public set(k: K, v: V): AvlNodeReference> { const root = this.root; if (!root) return this.insert(k, v);