riak_crdt is a CRDT loader for Riak using the crdt
from riak_crdt.loader import Loader from crdt.sets import LWWSet from riak import RiakClient client = RiakClient() bucket = client.bucket("friends") with Loader(LWWSet, bucket," "eric") as (loader, friend_set): friend_set.add("tom")
What just happened?
- The loader fetched the riak object at friends/eric
- If the object did not exist, a new LWWSet is created
- If the object did exist but had siblings, the LWWSet.merge method resolves the conflict.
- Otherwise, a LWWSet is used using the riak object's payload
- After the with block concludes, the Loader stores the object
Refer to the crdt README for more details.