Skip to content

Instantly share code, notes, and snippets.

@macintux
Last active January 3, 2016 19:08
Show Gist options
  • Save macintux/1f34d0443fdf029161c6 to your computer and use it in GitHub Desktop.
Save macintux/1f34d0443fdf029161c6 to your computer and use it in GitHub Desktop.
Minimally-tested update to riakc_set.erl to allow sets created via `new/2` to be sent to Riak properly.
--- a/src/riakc_set.erl
+++ b/src/riakc_set.erl
@@ -107,6 +107,8 @@ dirty_value(#set{value=V, adds=A, removes=R})
%% @doc Extracts an operation from the set that can be encoded i
%% update request.
-spec to_op(riakc_set()) -> riakc_datatype:update(set_op()).
+to_op(#set{value=V, adds=A, removes=R, context=undefined}) ->
+ {type(), {add_all, (V++A)--R}, undefined};
to_op(#set{adds=[], removes=[]}) ->
undefined;
to_op(#set{adds=A, removes=[], context=C}) ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment