logoot v1.0.0 Logoot.Sequence

A sequence of atoms identified by Logoot.atom_idents.

Summary

Types

A sequence_atom that represents the end of any Logoot.Sequence.t

A sequence_atom that represents the beginning of any Logoot.Sequence.t

A tuple {pos, v} generated at site s where ^pos = [ident_1, ident_2, {int, ^s}] is a position and v is the value of the vector clock of site s

The result of a comparison

A tuple {int, site}where int is an integer and site is a site identifier

A list of idents

An item in a sequence represented by a tuple {atom_ident, data} where atom_ident is a atom_ident and data is any term

t()

A sequence of sequence_atoms used to represent an ordered set

Functions

Delete the given atom from the sequence

Get the empty sequence

Generate an atom identifier between min and max

Insert a value into a sequence after the given atom identifier

Return only the values from the sequence

Insert the given atom into the sequence

Get the maximum sequence atom

Get the minimum sequence atom

Types

abs_max_atom_ident :: {[{32767, 0}, ...], 1}

A sequence_atom that represents the end of any Logoot.Sequence.t.

abs_min_atom_ident :: {[{0, 0}, ...], 0}

A sequence_atom that represents the beginning of any Logoot.Sequence.t.

atom_ident :: {position, non_neg_integer}

A tuple {pos, v} generated at site s where ^pos = [ident_1, ident_2, {int, ^s}] is a position and v is the value of the vector clock of site s.

comparison :: :gt | :lt | :eq

The result of a comparison.

ident :: {0..32767, term}

A tuple {int, site}where int is an integer and site is a site identifier.

position :: [ident]

A list of idents.

sequence_atom :: {atom_ident, term}

An item in a sequence represented by a tuple {atom_ident, data} where atom_ident is a atom_ident and data is any term.

t :: [sequence_atom]

A sequence of sequence_atoms used to represent an ordered set.

The first atom in a sequence will always be @min_sequence_atom and the last will always be @max_sequence_atom.

[
  {{[{0, 0}], 0}, nil},
  {{[{1, 1}], 0}, "This is an example of a Logoot Sequence"},
  {{[{1, 1}, {1, 5}], 23}, "How to find a place between 1 and 1"},
  {{[{1, 3}], 2}, "This line was the third made on replica 3"},
  {{[{32767, 0}], 1}, nil}
]

Functions

compare_atom_idents(atom_ident_a, atom_ident_b)

Specs

compare_atom_idents(atom_ident, atom_ident) :: comparison

Compare two atom identifiers.

Returns :gt if first is greater than second, :lt if it is less, and :eq if they are equal.

delete_atom(list, atom)

Specs

delete_atom(t, sequence_atom) :: t

Delete the given atom from the sequence.

empty_sequence()

Specs

empty_sequence :: [{abs_min_atom_ident | abs_max_atom_ident, nil}]

Get the empty sequence.

gen_atom_ident(agent_pid, min_atom_ident, max_atom_ident)

Specs

gen_atom_ident(pid, atom_ident, atom_ident) ::
  {:ok, atom_ident} |
  {:error, String.t}

Generate an atom identifier between min and max.

get_and_insert_after(sequence, prev_sibling_ident, value, agent_pid)

Specs

get_and_insert_after(t, atom_ident, term, pid) ::
  {:ok, {sequence_atom, t}} |
  {:error, String.t}

Insert a value into a sequence after the given atom identifier.

Returns a tuple containing the new atom and the updated sequence.

get_values(sequence)

Specs

get_values(t) :: [term]

Return only the values from the sequence.

insert_atom(list, atom)

Specs

insert_atom(t, sequence_atom) ::
  {:ok, t} |
  {:error, String.t}

Insert the given atom into the sequence.

max()

Specs

Get the maximum sequence atom.

min()

Specs

Get the minimum sequence atom.