Module dvvset

An Erlang implementation of *compact* Dotted Version Vectors, which provides a container for a set of concurrent values (siblings) with causal order information.

Copyright © The MIT License (MIT) Copyright (C) 2013 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Authors: Ricardo Tomé Gonçalves (tome.wave@gmail.com), Paulo Sérgio Almeida (pssalmeida@gmail.com).

References

Description

An Erlang implementation of *compact* Dotted Version Vectors, which provides a container for a set of concurrent values (siblings) with causal order information.

For further reading, visit the github page.

Data Types

clock()

clock() = {entries(), values()}

counter()

counter() = non_neg_integer()

entries()

entries() = [{id(), counter(), values()}]

id()

id() = any()

value()

value() = any()

values()

values() = [value()]

vector()

vector() = [{id(), counter()}]

Function Index

equal/2Compares the equality of both clocks, regarding only the causal histories, thus ignoring the values.
ids/1Returns all the ids used in this clock set.
join/1Return a version vector that represents the causal history.
last/2Returns the latest value in the clock set, according to function F(A,B), which returns *true* if A compares less than or equal to B, false otherwise.
less/2Returns True if the first clock is causally older than the second clock, thus values on the first clock are outdated.
lww/2Return a clock with the same causal history, but with only one value in its original position.
map/2Maps (applies) a function on all values in this clock set, returning the same clock set with the updated values.
new/1Constructs a new clock set without causal history, and receives a list of values that gos to the anonymous list.
new/2Constructs a new clock set with the causal history of the given version vector / vector clock, and receives a list of values that gos to the anonymous list.
reconcile/2Return a clock with the same causal history, but with only one value in the anonymous placeholder.
size/1Returns the total number of values in this clock set.
sync/1Synchronizes a list of clocks using sync/2.
update/2Advances the causal history with the given id.
update/3Advances the causal history of the first clock with the given id, while synchronizing with the second clock, thus the new clock is causally newer than both clocks in the argument.
values/1Returns all the values used in this clock set, including the anonymous values.

Function Details

equal/2

equal(C1::clock() | vector(), C2::clock() | vector()) -> boolean()

Compares the equality of both clocks, regarding only the causal histories, thus ignoring the values.

ids/1

ids(X1::clock()) -> [id()]

Returns all the ids used in this clock set.

join/1

join(X1::clock()) -> vector()

Return a version vector that represents the causal history.

last/2

last(LessOrEqual::fun((value(), value()) -> boolean()), C::clock()) -> value()

Returns the latest value in the clock set, according to function F(A,B), which returns *true* if A compares less than or equal to B, false otherwise.

less/2

less(X1::clock(), X2::clock()) -> boolean()

Returns True if the first clock is causally older than the second clock, thus values on the first clock are outdated. Returns False otherwise.

lww/2

lww(LessOrEqual::fun((value(), value()) -> boolean()), C::clock()) -> clock()

Return a clock with the same causal history, but with only one value in its original position. This value is the newest value in the given clock, according to function F(A,B), which returns *true* if A compares less than or equal to B, false otherwise.

map/2

map(F::fun((value()) -> value()), X2::clock()) -> clock()

Maps (applies) a function on all values in this clock set, returning the same clock set with the updated values.

new/1

new(Vs::value() | [value()]) -> clock()

Constructs a new clock set without causal history, and receives a list of values that gos to the anonymous list.

new/2

new(VV::vector(), Vs::value() | [value()]) -> clock()

Constructs a new clock set with the causal history of the given version vector / vector clock, and receives a list of values that gos to the anonymous list. The version vector SHOULD BE a direct result of join/1.

reconcile/2

reconcile(Winner::fun(([value()]) -> value()), C::clock()) -> clock()

Return a clock with the same causal history, but with only one value in the anonymous placeholder. This value is the result of the function F, which takes all values and returns a single new value.

size/1

size(X1::clock()) -> non_neg_integer()

Returns the total number of values in this clock set.

sync/1

sync(L::[clock()]) -> clock()

Synchronizes a list of clocks using sync/2. It discards (causally) outdated values, while merging all causal histories.

update/2

update(X1::clock(), I::id()) -> clock()

Advances the causal history with the given id. The new value is the *anonymous dot* of the clock. The client clock SHOULD BE a direct result of new/2.

update/3

update(X1::clock(), Cr::clock(), I::id()) -> clock()

Advances the causal history of the first clock with the given id, while synchronizing with the second clock, thus the new clock is causally newer than both clocks in the argument. The new value is the *anonymous dot* of the clock. The first clock SHOULD BE a direct result of new/2, which is intended to be the client clock with the new value in the *anonymous dot* while the second clock is from the local server.

values/1

values(X1::clock()) -> [value()]

Returns all the values used in this clock set, including the anonymous values.


Generated by EDoc