anchor.diff:  -include_lib("riak_kv_vnode.hrl").
   -ifdef(TEST).
   -include_lib("eunit/include/eunit.hrl").
  --export([test/7, test_link/7]).
  +-export([test_link/7, test_link/5]).
   -endif.
  --export([start/6, start_link/6]).
  +-export([start/6, start_link/6, start_link/4]).
   -export([init/1, handle_event/3, handle_sync_event/4,
            handle_info/3, terminate/3, code_change/4]).
  --export([prepare/2,execute/2,waiting_vnode_r/2,waiting_read_repair/2]).
  -
  --record(state, {client :: {pid(), reference()},
  +-export([prepare/2,validate/2,execute/2,waiting_vnode_r/2,waiting_read_repair/2]).
  +
  +-record(state, {from :: {integer(), pid()},
  +                options=[],
                   n :: pos_integer(),
                   r :: pos_integer(),
                   fail_threshold :: pos_integer(),
  
positive.code:     N = proplists:get_value(n_val,BucketProps),
      UpNodes = riak_core_node_watcher:nodes(riak_kv),
      Preflist2 = riak_core_apl:get_apl_ann(DocIdx, N, Ring, UpNodes),
      {next_state, execute, StateData#state{starttime=riak_core_util:moment(),
                                            n = N,
                                            bucket_props=BucketProps,
                                            preflist2 = Preflist2}, 0}.
  
  %% @private
  execute(timeout, StateData0=#state{timeout=Timeout, n=N, r=R0, req_id=ReqId,
                                     bkey=BKey, 
                                     bucket_props=BucketProps,
                                     preflist2 = Preflist2}) ->
      TRef = schedule_timeout(Timeout),
      R = riak_kv_util:expand_rw_value(r, R0, BucketProps, N),
      if
          R =:= error ->
              client_reply({error, {r_val_violation, R0}}, StateData0),
              {stop, normal, StateData0};
          R > N ->
              client_reply({error, {n_val_violation, N}}, StateData0),
              {stop, normal, StateData0};
          true ->
              FailThreshold = erlang:min((N div 2)+1, % basic quorum, or
                                         (N-R+1)), % cannot ever get R 'ok' replies
              AllowMult = proplists:get_value(allow_mult,BucketProps),
              Preflist = [IndexNode || {IndexNode, _Type} <- Preflist2],
              riak_kv_vnode:get(Preflist, BKey, ReqId),
              StateData = StateData0#state{n=N,r=R,fail_threshold=FailThreshold,
                                           allowmult=AllowMult,
                                           tref=TRef},
              {next_state,waiting_vnode_r,StateData}
      end.
  
  waiting_vnode_r({r, VnodeResult, Idx, _ReqId}, StateData) ->
      NewStateData1 = add_vnode_result(Idx, VnodeResult, StateData),
  
negative.code:                 startnow :: {pos_integer(), pos_integer(), pos_integer()}
                 }).
  
  -define(DEFAULT_TIMEOUT, 60000).
  -define(DEFAULT_R, quorum).
  
  %% In place only for backwards compatibility
  start(ReqId,Bucket,Key,R,Timeout,From) ->
      start_link({raw, ReqId, From}, Bucket, Key, [{r, R}, {timeout, Timeout}]).
  
  start_link(ReqId,Bucket,Key,R,Timeout,From) ->
      start_link({raw, ReqId, From}, Bucket, Key, [{r, R}, {timeout, Timeout}]).
  
  start_link(From, Bucket, Key, GetOptions) ->
      gen_fsm:start_link(?MODULE, [From, Bucket, Key, GetOptions], []).
  
  -ifdef(TEST).
  %% Create a get FSM for testing.  StateProps must include
  