anchor.diff:  -export_type([distribution/0, db_type/0, db_parameter/0, db_status/0, failure_type/0]).
   -endif.
   
  --type distribution() :: uniform |
  +-type distribution() :: random |
  +                        uniform |
                           {non_uniform, random_bias:distribution_fun()}.
   -type result() :: ?RT:key() | 
                     {?RT:key(), ?DB:value()}.
  
positive.code:                     KVV, Nodes),
      ok.
  
  % @doc Inserts a list of keys replicated into the ring
  -spec gen_kvv([?RT:key()], [db_parameter()]) -> {?DB:db_as_list(), db_status()}.
  gen_kvv(Keys, Params) ->
      FType = proplists:get_value(ftype, Params, update),
      FProb = proplists:get_value(fprob, Params, 50),
      FDest = proplists:get_value(fdest, Params, all),
      {DB, {I, M, O}} = 
          lists:foldl(
            fun(Key, {AccDb, {Ins, Mis, Out}}) ->
                    RepKeys = ?RT:get_replica_keys(Key),
                    %insert error?
                    EKey = case FProb >= randoms:rand_uniform(1, 100) of
                               true ->
                                   %error destination
                                   case FDest of
                                       all -> util:randomelem(RepKeys);
                                       QList -> rr_recon:map_key_to_quadrant(Key, util:randomelem(QList))
                                   end;
                               _ -> null
                           end,
                    %insert regen error
                    EType = case FType of 
                                mixed -> 
                                    case randoms:rand_uniform(1, 3) of
                                        1 -> update;
                                        _ -> regen
                                    end;
                                _ -> FType
                            end,
                    RGrp = [db_entry:new(X, val, 2) || X <- RepKeys, X =/= EKey],
                    %insert update error
                    {NewOut, RList} = if EType =:= update andalso EKey =/= null ->
                                             {Out + 1, [db_entry:new(EKey, old, 1) | RGrp]};
                                         true -> {Out, RGrp}
                                      end,
                    RListL = length(RList),
                    {lists:append(RList, AccDb), {Ins + RListL, Mis + 4 - RListL, NewOut}}
            end, 
            {[], {0, 0, 0}}, Keys),
      {DB, {length(Keys) * ?ReplicationFactor, I, M, O}}.
  
  -spec get_node_list() -> [comm:mypid()].
  get_node_list() ->
  
negative.code: get_db(Interval, ItemCount, Distribution, Options) ->
      OutputType = proplists:get_value(output, Options, list_key),
      case Distribution of
          random -> log:log(error, "random_data_distribution is not implemented");
          uniform -> uniform_key_list([{Interval, ItemCount}], [], OutputType);
          {non_uniform, Fun} -> non_uniform_key_list(Interval, 1, ItemCount, Fun, [], OutputType)
      end.
  