anchor.diff: -% @copyright 2012-2014 Zuse Institute Berlin,
  +% @copyright 2012-2015 Zuse Institute Berlin,
   
   %   Licensed under the Apache License, Version 2.0 (the "License");
   %   you may not use this file except in compliance with the License.
  
positive.code:                                   ReadFilterResultValue}, State);
  
  on({do_qwrite_fast, ReqId, Round, OldRFResultValue}, State) ->
      Entry = setelement(2, get_entry(ReqId, tablename(State)), do_qwrite_fast),
      ContentCheck = element(2, entry_filters(Entry)),
      WriteFilter = element(3, entry_filters(Entry)),
      WriteValue = entry_val(Entry),
  
      _ = case ContentCheck(OldRFResultValue, WriteFilter, WriteValue) of
          {true, PassedToUpdate} ->
              %% own proposal possible as next instance in the consens sequence
              This = comm:reply_as(comm:this(), 3, {qwrite_collect, ReqId, '_'}),
              DB = db_selector(State),
                  [ begin
                        %% let fill in whether lookup was consistent
                        LookupEnvelope =
                            dht_node_lookup:envelope(
                              4,
                              {prbr, write, DB, '_', This, X, Round,
                               WriteValue, PassedToUpdate, WriteFilter}),
                        api_dht_raw:unreliable_lookup(X, LookupEnvelope)
                    end
                    || X <- ?RT:get_replica_keys(entry_key(Entry)) ];
          {false, Reason} = _Err ->
              %% own proposal not possible as of content check
              comm:send_local(entry_client(Entry),
                              {qwrite_deny, ReqId, Round, OldRFResultValue,
                               {content_check_failed, Reason}}),
              ?PDB:delete(ReqId, tablename(State))
      end,
      State;
  
  %% qwrite step 3: a replica replied to write from step 2
  %%                when      majority reached, -> finish.
  
negative.code: -spec retrigger(entry(), ?PDB:tableid(), incdelay|noincdelay) -> ok.
  retrigger(Entry, TableName, IncDelay) ->
      Request = req_for_retrigger(Entry, IncDelay),
      ?TRACE("Retrigger caused by timeout or concurrency for ~.0p~n", [Request]),
      comm:send_local(self(), Request),
      ?PDB:delete(element(1, Entry), TableName).
  
  