You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// //each version looks like an update message...
416
416
/// ],
417
417
/// fissures: [
418
418
/// //each fissure looks as it would in a fissure message...
@@ -538,16 +538,16 @@ var sequence_crdt = {};
538
538
self.forget_cbs[conn]();
539
539
}
540
540
541
-
/// ## message `set`
541
+
/// ## message `update`
542
542
/// Sent to alert peers about a change in the document. The change is represented as a version, with a unique id, a set of parent versions (the most recent versions known before adding this version), and an array of patches, where the offsets in the patches do not take into account the application of other patches in the same array.
/// Sent for pruning purposes, to try and establish whether everyone has seen the most recent versions. Note that a `set` message is treated as a `ackme` message for the version being set.
566
+
/// Sent for pruning purposes, to try and establish whether everyone has seen the most recent versions. Note that an `update` message is treated as a `ackme` message for the version in the update.
/// Sent in response to `set`, but not right away; a peer will first send the `set` over all its other connections, and only after they have all responded with a local `ack` – and we didn't see a `fissure` message while waiting – will the peer send a local `ack` over the originating connection.
631
+
/// Sent in response to `update`, but not right away; a peer will first send the `update` over all its other connections, and only after they have all responded with a local `ack` – and we didn't see a `fissure` message while waiting – will the peer send a local `ack` over the originating connection.
/// Modify this antimatter_crdt object by applying the given patches. Each patch looks like `{range: '.life.meaning', content: 42}`. Calling this method will trigger calling the `send` callback to let our peers know about this change.
810
810
///
811
811
/// ``` js
812
-
/// antimatter_crdt.set({
812
+
/// antimatter_crdt.update({
813
813
/// range: '.life.meaning',
814
814
/// content: 42
815
815
///})
816
816
/// ```
817
-
self.set=(...patches)=>{
817
+
self.update=(...patches)=>{
818
818
varversion=`${self.next_seq++}@${self.id}`;
819
819
self.receive({
820
-
type: "set",
820
+
type: "update",
821
821
version,
822
822
parents: { ...self.current_version},
823
823
patches,
@@ -1088,7 +1088,7 @@ var sequence_crdt = {};
1088
1088
1089
1089
/// # json_crdt.generate_braid(versions)
1090
1090
///
1091
-
/// Returns an array of `set` messages that each look like this: `{version, parents, patches, sort_keys}`, such that if we pass all these messages to `antimatter_crdt.receive()`, we'll reconstruct the data in this `json_crdt` data-structure, assuming the recipient already has the given `versions` (each version is represented as a key in an object, and each value is `true`).
1091
+
/// Returns an array of `update` messages that each look like this: `{version, parents, patches, sort_keys}`, such that if we pass all these messages to `antimatter_crdt.receive()`, we'll reconstruct the data in this `json_crdt` data-structure, assuming the recipient already has the given `versions` (each version is represented as a key in an object, and each value is `true`).
/// # sequence_crdt.update(root_node, i, v, is_anc)
1847
1847
///
1848
1848
/// Sets the element at the `i`th position (0-based) in the `sequence_crdt` rooted at `root_node` to the value `v`, when only considering versions which result in `true` when passed to `is_anc`.
0 commit comments