Liking cljdoc? Tell your friends :D

dk.simongray.mind-meld.list

Ordered collections in a mind-meld state, e.g. a queue, which devices change in any order without conflict.

An ordered collection is a map of id to an entry with a :rank, a string that sorts by the entry's place. A move can go in a second map of the same ids, whose entries hold only the new rank, so that a move never brings back what another device removed. A schema marks both :ranked?:

{:queue       {:depth 1 :ranked? true}
 :queue-moves {:depth 1 :ranked? true}}

The comments name the source of each part, and where it departs from it:

Ordered collections in a mind-meld state, e.g. a queue, which devices
change in any order without conflict.

An ordered collection is a map of id to an entry with a :rank, a string
that sorts by the entry's place. A move can go in a second map of the
same ids, whose entries hold only the new rank, so that a move never
brings back what another device removed. A schema marks both :ranked?:

    {:queue       {:depth 1 :ranked? true}
     :queue-moves {:depth 1 :ranked? true}}

The comments name the source of each part, and where it departs from it:

- Wallace, Realtime Editing of Ordered Sequences, Figma, 2017,
  https://www.figma.com/blog/realtime-editing-of-ordered-sequences/
- Kleppmann, Gomes, Mulligan and Beresford, Interleaving anomalies in
  collaborative text editors, PaPoC 2019,
  https://doi.org/10.1145/3301419.3323972
- Kleppmann, Moving Elements in List CRDTs, PaPoC 2020,
  https://doi.org/10.1145/3380787.3393677
raw docstring

appendclj/s

(append state path entries ids at)

The state with the ids written at at to the end of the ordered entries at path, unless they're there already. The entries should have their moves applied.

The `state` with the `ids` written at `at` to the end of the ordered
`entries` at `path`, unless they're there already. The `entries` should
have their moves applied.
sourceraw docstring

appendedclj/s

(appended state path entries ids)

The writes that put the ids in order at the end of the ordered entries at path in state, as pairs of a path and a function.

The entries should have their moves applied, so that the ids go after an entry that was moved to the end. An id that's already there stays where it is. The ranks are in a block of the state's device, so that ids that another device appends at the same time don't mix with them.

The writes that put the `ids` in order at the end of the ordered
`entries` at `path` in `state`, as pairs of a path and a function.

The `entries` should have their moves applied, so that the ids go after
an entry that was moved to the end. An id that's already there stays
where it is. The ranks are in a block of the state's device, so that ids
that another device appends at the same time don't mix with them.
sourceraw docstring

problemclj/s

(problem schema state)

A description of the first entry whose :rank isn't a rank, in the collections of state that the schema marks :ranked?, or nil. Such a rank, e.g. from another version of an app, makes sorting throw.

A description of the first entry whose :rank isn't a rank, in the
collections of `state` that the `schema` marks :ranked?, or nil. Such a
rank, e.g. from another version of an app, makes sorting throw.
sourceraw docstring

rank-atclj/s

(rank-at entries id index)

The rank that moves the entry id to index among the ordered entries. An index that isn't whole is rounded down, and NaN counts as 0.

The rank that moves the entry `id` to `index` among the ordered
`entries`. An index that isn't whole is rounded down, and NaN counts as
0.
sourceraw docstring

rank-at-endclj/s

(rank-at-end entries)

A rank after every live entry of the ordered entries.

A rank after every live entry of the ordered `entries`.
sourceraw docstring

rank-betweenclj/s

(rank-between entries before-id after-id)

A rank between the entries of the ids before-id and after-id of the ordered entries, either of which can be nil for an end, and after any entries that share the rank of before-id.

A rank between the entries of the ids `before-id` and `after-id` of the
ordered `entries`, either of which can be nil for an end, and after any
entries that share the rank of `before-id`.
sourceraw docstring

rankedclj/s

(ranked entries)

The live entries of an ordered collection as [id entry] pairs by rank, and by stamp and device when two ranks are equal.

The live `entries` of an ordered collection as [id entry] pairs by
rank, and by stamp and device when two ranks are equal.
sourceraw docstring

with-movesclj/s

(with-moves entries moves)

The ordered entries, each at the place of its live entry in moves when that's the later of the two.

The ordered `entries`, each at the place of its live entry in `moves`
when that's the later of the two.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close