mochi/statebox_riak

Convenience library that makes it easier to use statebox with riak, extracted from best practices in our production code at Mochi Media.

Erlang

50

10 commits

updated Nov 20, 2013

See the code

README

statebox_riak - statebox + riak-erlang-client convenience library

bob@redivi.com

Overview:

Convenience library that makes it easier to use statebox with riak, extracted from best practices in our production code at Mochi Media.

Status:

Used in production at Mochi Media.

Usage:

{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087),
S = statebox_riak:new([{riakc_pb_socket, Pid}]),
statebox_riak:apply_bucket_ops(
    <<"friends">>,
    [{[<<"bob">>], statebox_orddict:f_union(following, [<<"alice">>])},
     {[<<"alice">>], statebox_orddict:f_union(followers, [<<"bob">>])}],
    S),
[<<"alice">>] = orddict:fetch(
    following, statebox_riak:get_value(<<"friends">>, <<"bob">>, S)),
[<<"bob">>] = orddict:fetch(
    followers, statebox_riak:get_value(<<"friends">>, <<"alice">>, S)).

Contributors

etrepum

8 commits

doubleyou

1 commits

rpt

1 commits

mochi/statebox_riak

Convenience library that makes it easier to use statebox with riak, extracted from best practices in our production code at Mochi Media.

Erlang

50

10 commits

updated Nov 20, 2013

See the code

README

statebox_riak - statebox + riak-erlang-client convenience library

bob@redivi.com

Overview:

Convenience library that makes it easier to use statebox with riak, extracted from best practices in our production code at Mochi Media.

Status:

Used in production at Mochi Media.

Usage:

{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087),
S = statebox_riak:new([{riakc_pb_socket, Pid}]),
statebox_riak:apply_bucket_ops(
    <<"friends">>,
    [{[<<"bob">>], statebox_orddict:f_union(following, [<<"alice">>])},
     {[<<"alice">>], statebox_orddict:f_union(followers, [<<"bob">>])}],
    S),
[<<"alice">>] = orddict:fetch(
    following, statebox_riak:get_value(<<"friends">>, <<"bob">>, S)),
[<<"bob">>] = orddict:fetch(
    followers, statebox_riak:get_value(<<"friends">>, <<"alice">>, S)).

Contributors

etrepum

8 commits

doubleyou

1 commits

rpt

1 commits

Languages

Erlang

100.0%