Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valter's work addressing basho/riak_dt#99 #113

Open
wants to merge 34 commits into
base: 2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
21cd034
WIP smaller map, maybe
russelldb Dec 8, 2014
1462e3d
WIP smaller map, doesn't keep duplicate fields (merges on merge)
russelldb Dec 8, 2014
3278a6d
unit tests
Dec 29, 2014
92a49b1
Work in progress: remove leaf
Jan 2, 2015
fbe2575
Added remove subtree test
Jan 4, 2015
42ea8c1
Work in progress:
Jan 4, 2015
92d0538
Fixed Map equals
Jan 4, 2015
db9d3c6
Stuff not to forget
Jan 5, 2015
5291c07
Tests for field removes in a subtree.
Jan 6, 2015
8e3f4e0
Tests updated
Jan 7, 2015
7810b07
WIP - modified merge and a few things to correct some cases that fail…
Jan 7, 2015
d9f35ed
Added visibility to value(), changed tests accordingly;
Jan 9, 2015
dae4417
Continued with refactoring
Jan 9, 2015
f28af34
Added get_deferred operation.
Jan 12, 2015
093689a
Fixed issue with reading from non-lists deferred operations.
Jan 12, 2015
ff3f73c
Added clear operations to some CRDTs.
Jan 13, 2015
a06dad4
Simpler way to clear the CRDT and is not exposed in the interface.
Jan 13, 2015
f48ea2b
Removed redundant ctx_rem_field operation.
Jan 13, 2015
a594530
Added transactional tests
Jan 13, 2015
3587437
Separate meta-data from value
Jan 22, 2015
d2feb2e
Corrections taken from the delta implementation.
Jan 27, 2015
34ae622
WIP - Cleaning the code
Jan 31, 2015
c40b8fc
Ran Dialyzer
Feb 3, 2015
6b2f238
Removed generic riak_dt:get_deferred/1 implementation and removed get…
Feb 4, 2015
9d09195
Changed some type names.
Feb 6, 2015
6aea55f
Fixed wrong merge - error found by QuickCheck
Feb 10, 2015
8756f68
Set entries parent clock.
russelldb Feb 10, 2015
4f14567
Some map fixes.
Feb 11, 2015
daf9d60
WIP - Quickcheck Passing; needs cleanup.
Feb 15, 2015
e7af482
More QuickCheck Fixes.
Feb 18, 2015
afb03a9
Code indentation.
Feb 18, 2015
3bddd00
When running EQC, use an orddict for easier to read output
russelldb Feb 23, 2015
44b7656
Merge branch 'exper/balegas/issue99' of https://github.com/basho/riak…
Feb 23, 2015
54ab49d
Fix another quick check error
Feb 23, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/riak_dt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@
%% the clock and the crdt, and if relevant, returns to crdt with the
%% given clock as it's own.
-callback parent_clock(riak_dt_vclock:vclock(), crdt()) ->
crdt().
crdt().
-callback get_deferred(crdt()) -> [context()].
-callback merge(crdt(), crdt()) -> crdt().
-callback equal(crdt(), crdt()) -> boolean().
-callback to_binary(crdt()) -> binary().
-callback to_binary(TargetVers :: pos_integer(), crdt()) ->
binary().
binary().
-callback from_binary(binary()) -> crdt().
-callback from_binary(TargetVers :: pos_integer(), binary()) ->
crdt().
Expand Down Expand Up @@ -76,7 +77,6 @@ to_binary(Term) ->
from_binary(Binary) ->
binary_to_term(Binary).


%% @private
-spec dict_to_orddict(dict()) -> orddict:orddict().
dict_to_orddict(Dict) ->
Expand Down
7 changes: 5 additions & 2 deletions src/riak_dt_disable_flag.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
-behaviour(riak_dt).

-export([new/0, value/1, value/2, update/3, merge/2, equal/2, from_binary/1, to_binary/1, stats/1, stat/2]).
-export([update/4, parent_clock/2]).
-export([update/4, parent_clock/2, get_deferred/1]).
-export([to_binary/2, from_binary/2]).
-ifdef(EQC).
-include_lib("eqc/include/eqc.hrl").
Expand Down Expand Up @@ -65,7 +65,7 @@ update(disable, _Actor, _Flag) ->
{ok, off}.

-spec update(disable_flag_op(), riak_dt:actor(), disable_flag(), riak_dt:context()) ->
{ok, disable_flag()}.
{ok, disable_flag()}.
update(Op, Actor, Flag, _Ctx) ->
update(Op, Actor, Flag).

Expand All @@ -82,6 +82,9 @@ equal(FA,FB) ->
parent_clock(_Clock, Flag) ->
Flag.

-spec get_deferred(disable_flag()) -> [].
get_deferred(_Flag) -> [].

-spec from_binary(binary()) -> disable_flag().
from_binary(<<?TAG:7, 0:1>>) -> off;
from_binary(<<?TAG:7, 1:1>>) -> on.
Expand Down
4 changes: 3 additions & 1 deletion src/riak_dt_emcntr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
-export([to_binary/1, from_binary/1]).
-export([to_binary/2, from_binary/2]).
-export([stats/1, stat/2]).
-export([parent_clock/2, update/4]).
-export([update/4, parent_clock/2, get_deferred/1]).

%% EQC API
-ifdef(EQC).
Expand Down Expand Up @@ -85,6 +85,8 @@ new() ->
parent_clock(Clock, {_, Cntr}) ->
{Clock, Cntr}.

get_deferred(_CRDT) -> [].

%% @doc the current integer value of the counter
-spec value(emcntr()) -> integer().
value({_Clock, PNCnt}) ->
Expand Down
5 changes: 4 additions & 1 deletion src/riak_dt_enable_flag.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
-behaviour(riak_dt).

-export([new/0, value/1, value/2, update/3, merge/2, equal/2, from_binary/1, to_binary/1, stats/1, stat/2]).
-export([update/4, parent_clock/2]).
-export([update/4, parent_clock/2, get_deferred/1]).
-export([to_binary/2, from_binary/2]).

-ifdef(EQC).
Expand Down Expand Up @@ -74,6 +74,9 @@ update(enable, _Actor, _Flag, _Ctx) ->
parent_clock(_Clock, Flag) ->
Flag.

-spec get_deferred(enable_flag()) -> [].
get_deferred(_CRDT) -> [].

-spec merge(enable_flag(), enable_flag()) -> enable_flag().
merge(FA, FB) ->
flag_or(FA, FB).
Expand Down
5 changes: 4 additions & 1 deletion src/riak_dt_gcounter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
-module(riak_dt_gcounter).
-behaviour(riak_dt).
-export([new/0, new/2, value/1, value/2, update/3, merge/2, equal/2, to_binary/1, from_binary/1, stats/1, stat/2]).
-export([update/4, parent_clock/2]).
-export([update/4, parent_clock/2, get_deferred/1]).
-export([to_binary/2, from_binary/2]).

%% EQC API
Expand Down Expand Up @@ -95,6 +95,9 @@ update(Op, Actor, GCnt, _Ctx) ->
parent_clock(_Clock, GCnt) ->
GCnt.

-spec get_deferred(gcounter()) -> [].
get_deferred(_CRDT) -> [].

%% @doc Merge two `gcounter()'s to a single `gcounter()'. This is the Least Upper Bound
%% function described in the literature.
-spec merge(gcounter(), gcounter()) -> gcounter().
Expand Down
5 changes: 4 additions & 1 deletion src/riak_dt_gset.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
%% API
-export([new/0, value/1, update/3, merge/2, equal/2,
to_binary/1, from_binary/1, value/2, stats/1, stat/2]).
-export([update/4, parent_clock/2]).
-export([update/4, parent_clock/2, get_deferred/1]).
-export([to_binary/2, from_binary/2]).

-ifdef(EQC).
Expand Down Expand Up @@ -92,6 +92,9 @@ update(Op, Actor, GSet, _Ctx) ->
parent_clock(_Clock, GSet) ->
GSet.

-spec get_deferred(gset()) -> [].
get_deferred(_CRDT) -> [].

-spec merge(gset(), gset()) -> gset().
merge(GSet1, GSet2) ->
ordsets:union(GSet1, GSet2).
Expand Down
5 changes: 4 additions & 1 deletion src/riak_dt_lwwreg.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

-export([new/0, value/1, value/2, update/3, merge/2,
equal/2, to_binary/1, from_binary/1, stats/1, stat/2]).
-export([parent_clock/2, update/4]).
-export([update/4, parent_clock/2, get_deferred/1]).
-export([to_binary/2, from_binary/2]).

%% EQC API
Expand Down Expand Up @@ -63,6 +63,9 @@ new() ->
parent_clock(_Clock, Reg) ->
Reg.

-spec get_deferred(lwwreg()) -> [].
get_deferred(_CRDT) -> [].

%% @doc The single total value of a `gcounter()'.
-spec value(lwwreg()) -> term().
value({Value, _TS}) ->
Expand Down
Loading