Description
(I am currently in the design phase of a project hence I looked into this and opened ticket for tracking.)
Expected result
To disable an existing flag, you have to read it or provide a context.
Also, first the non-merged PR https://github.com/basho/basho_docs/pull/1550/files#diff-b79a647609dd35cb310d1d7cddf7a12aR1005 and then the recently merged PR https://github.com/basho/basho_docs/pull/2315/files#diff-3eef66dba92a758b737a0b505eea4645R449 proposed update of HTTP example along this line.
Actual result on HTTP
Via HTTP API on Riak KV 2.2.0:
- I created (without context) a CRDT initializing flag in map specifying operation "enable";
- I checked flag was true;
- I waited 5 seconds (just to be sure... but should not matter);
- Then without context I updated flag in map specifying operation "disable";
- I checked flag was false. <-- This is wrong according to the documentation.
Actual result on PB
Via PB API (riakc), a disable operation for a flag in a map cannot be encoded without context.
Considerations
I understand that the recommended API is PB. That said, I would expect the presence of the context in any disable operation of a flag in a map to be validated also server side by Riak KV, rather than performing an unsafe choice somewhere in Riak KV (at least when called via HTTP). This would make all Riak KV clients, both PB and HTTP based, more robust.
I understand the relevant CRDT is https://github.com/basho/riak_dt/blob/f96f943ca66902e12263a445cf9099d7f635d5ab/src/riak_dt_od_flag.erl#L3-L4 (not sure about the version/changeset of such CRDT in Riak KV 2.2.0).