Hi,
It’s a long story.

The short answer is: you can’t with that client, it has strong opinions so the 
best thing to do is this: have your app interpret the absence of a flag as 
false (the bottom/default value for a flag.)

The long story: the semantic for the flag is “observed remove” or “add-wins” 
(in fact the semantic is “add-wins”, “observe remove” is just how it does it) 
which means you have to observe an enabled flag (which will have a context) in 
order to disable it. The context tells riak at exactly what logical time you 
observed the enabled flag. This is to prevent a request to “disable flag” at 
the same logical time as an “enable flag” winning over the “enable” in a 
race/by chance. Ideally the absence of a flag would be indicated by the client 
as the flag’s default/bottom value (disabled/false) however, for some reason we 
went with a kind of 3-state deal of does-not-exist/enabled/disabled. My opinion 
is that this was a bad idea. But it is the state of the world, and so we have 
to live with it for now. In future, I think it should be possible to use 
“new/0” to create a flag in the bottom state. It’s something we know how to do, 
we just haven’t done it yet. Sorry.

Cheers

Russell

On 6 Aug 2015, at 17:43, 王昊 <jusf...@163.com> wrote:

> When  I try this in Erlang:(saving a new Map object to a bucket through )
> 
>       Map   = riakc_map:new(),
>       Map1 = riakc_map:update({<<"published_b">>, flag},
>                         fun(F) -> riakc_flag:disable(F) end, Map);
> 
> I got context_required. How could I create a false flag? I tried enable/1, it 
> seems ok. Should I use new/0?
> 
> --
> 
> Hao Wang
> 
>   
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to