maca/crdt-replicated-graph/1.0.0

Renamed to maca/crdt-replicated-tree. It is published under that name, and new versions come out there.

Versions published as maca/crdt-replicated-graph still install under that name. 1 version of 1 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/maca/crdt-replicated-tree.

What we checked: The repo moved to github.com/maca/crdt-replicated-tree. Rebuilt with git archive from commit 0986f446b1f0 of https://github.com/maca/crdt-replicated-tree (zip prefix maca-crdt-replicated-graph-0986f44/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 16b0e58ba155cef5f9323496009ff3083bfd4335.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/maca/crdt-replicated-graph/zipball/1.0.0/

RG.Node

This module implements types and functions to build, find, get values from, and compare nodes

type Node a
= Node
{ path : Path
, children : List (Node a)
, data : Maybe a
}
| Tombstone { path : Path }

Node can be either a branch or leaf Node with optional data or a Tombstone representing a removed Node

type alias Path =
List Int

The path of the node is represented as a list of integers

init : Maybe a -> Path -> Node a

Build a node

timestamp (node (Just 'a') [0, 1]) == 1
path (node (Just 'a') [0, 1]) == [0, 1]
data (node (Just 'a') [0, 1]) == Just 'a'

Build a root node

timestamp root == 0
path root == []
data root == Nothing
tombstone : Path -> Node a

Build a tombstone providing timestamp and path

timestamp (tombstone [0, 1]) == 1
path (tombstone [0, 1]) == [0, 1]
data (tombstone [0, 1]) == Nothing
children : Node a -> List (Node a)

Return a list of a nodes' children

data : Node a -> Maybe a

Return the data of a node

data (node (Just 'a') [0, 1]) == Just 'a'
data (tombstone [0, 1]) == Nothing
timestamp : Node a -> Int

Return the timestamp of a node

timestamp (node (Just 'a') [0, 1]) == 1
path : Node a -> Path

Return the path of a node

path (node (Just 'a') [0, 1]) == [0, 1]
descendant : Path -> Node a -> Maybe (Node a)

Return Just a nodes' descendant if found by path or Nothing

hasTimestamp : Int -> Node a -> Bool

Determine wether a node has a timestamp

hasTimestamp 1 (node (Just 'a') [0, 1]) == True
hasTimestamp 1 (node (Just 'a') [0, 2]) == False