basho/riak-erlang-client — pull request #114 by seancribbs (2013-09-09 18:40:06+00:00)
Title: Add API to Riak 2.0 convergent datatypes

This pull-request requires basho/riak_pb#52 and a Riak built with basho/riak_kv#650.

Convergent types are represented on the client side by wrapper records and modules that manipulate them, currently `riakc_counter`, `riakc_set`, and `riakc_map`. Also included are `riakc_flag` and `riakc_register`, which may only be embedded in "map" types. The wrappers follow two principles:

1. Data retrieved from the server is treated as immutable. A representation that reflects locally-queued modifications must be explicitly requested, and "query" functions only operate on the immutable value.
2. The capturing of local modifications is not predicated on the fetched value. For example, one may "add" an element to a set without necessarily checking whether it already exists in the set.

Interaction with Riak should mostly be done through `riakc_pb_socket:modify_type()`, which fetches the data type, passes it through the user-specified modification function, and then writes the operations back to the cluster. For those who want to work with them manually, `fetch_type()` and `update_type()` are available.

- [x] Container types/modules
- [x] Requests/responses
- [ ] Type-specific tests
- [ ] Integration tests