Maybe VClock is either the VClock of the object you are updating ( Just vclock ) or Nothing . You can specify Nothing here if there is no object in the database for this key.
VClock wrapped in IO ( IO (c, VClock) ) is the VClock of an inserted object returned from the database.
To use this put function, your ToJSON and FromJSON instance will be required for your data type. Aeson contains instructions for recording this automatically. You can store data other than JSON with Network.Riak.Value modules, but it's more complicated.
Resolvable is used to resolve two siblings and looks like this: a and b are MyDataType s:
instance Resolvable MyDataType where resolve ab = a
Ideally, your resolution function does something more intelligent than just choosing a or b , since ordering is not guaranteed and can be called several times if there are several siblings.
here is some code to create a Riak connection pool that you might find useful.
You end up with something similar to this:
put conn bucket key Nothing value Quorum Quorum
where value is your data. Read more about Quorum here .
source share