Associating Riak CRDT Sets to Buckets / Keys via Erlang Client

Vikram Lalit vikramlalit at
Wed Nov 16 12:40:08 EST 2016

Hi - I am trying to leveraging CRDT sets to store chat messages that my
distributed Riak infrastructure would store. Given the intrinsic
conflict-resolution, I thought this might be more beneficial than me
putting together a merge implementation based on the causal context.

However, my data model requires each chat message to be associated to
something like a post, hence I was thinking of having the post reference as
the bucket, and chat references as keys in that bucket. With of course the
bucket-type datasource equated to 'set'. Unfortunately though, from the
documentation, I'm not able to ascertain how to associate a created set
with an existing bucket and a new key reference if I use the Erlang client.
This seems possible for other languages but not for Erlang, with the Basho
doc mentioning  "%% Sets in the Erlang client are opaque data structures
that collect operations as you mutate them. We will associate the data
with a bucket type, bucket, and key later on.".

Subsequent code only seems to fetch the set from the bucket / key but where
exactly is the allocation happening?

{ok, SetX} = riakc_pb_socket:fetch_type(Pid, {<<"sets">>,<<"travel">>}, <<

Perhaps I'm missing something, or is there a code snippet that I can

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list