Behaviours: riak_dt.
References
http://hal.upmc.fr/inria-00555588/
See also: riak_kv_gcounter.
dot with P and N. Merge takes the max
event for each actor, so newer values win over old ones. The rest
of the mechanics are the same.
decrement_op() = decrement | {decrement, integer()}
emcntr() = {riak_dt_vclock:vclock(), [entry()]}
emcntr_op() = increment_op() | decrement_op()
entry() = {Actor::riak_dt:actor(), {Event::pos_integer(), Inc::pos_integer(), Dec::pos_integer()}}
increment_op() = increment | {increment, integer()}
| equal/2 | equality of two counters internal structure, not the value/1
they produce. |
| from_binary/1 | Decode a binary encoded riak_dt_emcntr. |
| merge/2 | takes two emcntr()s and merges them into a single
emcntr(). |
| new/0 | |
| parent_clock/2 | embedded CRDTs most share a causal context with their parent Map, setting the internal clock to the parent clock ensures this. |
| stat/2 | generate stat for requested stat type at first argument. |
| stats/1 | generate stats for this counter. |
| to_binary/1 | produce a compact binary representation of the counter. |
| to_binary/2 | |
| to_version/2 | |
| update/3 | increment/decrement the counter. |
| update/4 | update with a context. |
| value/1 | the current integer value of the counter. |
| value/2 | query value, not implemented. |
equality of two counters internal structure, not the value/1
they produce.
from_binary(Bin::binary()) -> {ok, emcntr()} | {error, invalid_binary} | {error, unsupported_version, Vers::pos_integer()}
Decode a binary encoded riak_dt_emcntr.
See also: to_binary/1.
takes two emcntr()s and merges them into a single
emcntr(). This is the Least Upper Bound of the Semi-Lattice/CRDT
literature. The semantics of the emnctr() merge are explained in
the module docs. In a nutshell, merges version vectors, and keeps
only dots that are present on both sides, or concurrent.
new() -> emcntr()
parent_clock(Clock::riak_dt_vclock:vclock(), X2::emcntr()) -> emcntr()
embedded CRDTs most share a causal context with their parent Map, setting the internal clock to the parent clock ensures this
stat(X1::atom(), X2::emcntr()) -> pos_integer() | undefined
generate stat for requested stat type at first argument. Only
actor_count is supported at present. Return a pos_integer() for
the stat requested, or undefined if stat type is unsupported.
stats(Emcntr::emcntr()) -> [{actor_count, pos_integer()}]
generate stats for this counter. Only actor_count is
produced at present.
to_binary(Cntr::emcntr()) -> binary()
produce a compact binary representation of the counter.
See also: from_binary/1.
to_binary(Vers::pos_integer(), Cntr::emcntr()) -> {ok, binary()} | {error, unsupported_version, Vers::pos_integer()}
update(Op::emcntr_op(), Dot::riak_dt:dot(), X3::emcntr()) -> {ok, emcntr()}
increment/decrement the counter. Op is either a two tuple of
{increment, By}, {decrement, By} where By is a positive
integer. Or simply the atoms increment or decrement, which are
equivalent to {increment | decrement, 1} Returns the updated
counter.
riak_dt:dot(), that is a
2-tuple of {Actor :: term(), Event :: pos_integer()} as this is
for embedding in a riak_dt_map
update(Op::emcntr_op(), Dot::riak_dt:dot(), Cntr::emcntr(), Ctx::riak_dt_vclock:vclock()) -> {ok, emcntr()}
update with a context. Contexts have no effect. Same as
update/3
value(X1::emcntr()) -> integer()
the current integer value of the counter
value(X1::term(), Cntr::emcntr()) -> integer()
query value, not implemented. Just returns result of value/1
Generated by EDoc