basho/riak_kv — pull request #708 by russelldb (2013-10-22 21:06:52+00:00)
Title: Add validator support for data types 

Only allow `datatype' bucket property to be set on `create`.
Only allow `allow_mult=true` for `datatype` buckets.
Only allow `datatype` bucket to be a supported type.

What do we do if we _retire_ a type in a future version? I dunno.

riak datatype support requires a bucket type of `datatype`
and `allow_mult` set to `true`. This PR enforces those two properties. We take the presence of a `datatype' property
as indication that a bucket type is a special type, somewhere to
store CRDTs. I realise this somewhat undermines the reason for
bucket types (no magic names) but there has to be some way to
indicate intent, and that way is the "special" property name
`datatype`.

Since we don't ever want sibling CRDT types (though we can handle
them see `riak_kv_crdt`), `datatype` is an immutable property. Once
you create a bucket with a certain datatype you can't change
it. The `update` bucket type path enforces this. It doesn't
validate the type, since it assumes that was done at creation.

I've hand tested. I'm adding riak_tests. Hopefully a review can start here while I finish that.

ping @jrwest