anchor.diff:                    -> {ok, vectorclock()} | {error, term()}.
   update_clock(Partition, Dc_id, Timestamp) ->
       Indexnode = {Partition, node()},
  -    lager:info("Preflist of vectorclokc ~p", [Indexnode]),
  +    lager:info("Updating Preflist of vectorclock ~p", [Indexnode]),
       case riak_core_vnode_master:sync_command(Indexnode,
                                                {update_clock, Dc_id, Timestamp},
                                                vectorclock_vnode_master) of
  
positive.code: -module(vectorclock).
  
  -include("floppy.hrl").
  
  -export([get_clock/1, update_clock/3, get_clock_by_key/1,
           is_greater_than/2,
           get_clock_of_dc/2,
           get_clock_node/1,
           from_list/1]).
  
  -export_type([vectorclock/0]).
  
  
negative.code: get_clock_of_dc(Dcid, VectorClock) ->
      dict:find(Dcid, VectorClock).
  
  set_clock_of_dc(DcId, Time, VectorClock) ->
      dict:update(DcId,
                  fun(_Value) ->
                          Time
                  end,
                  Time,
                  VectorClock).
  
  from_list(List) ->
      dict:from_list(List).
  
  eq(V1, V2) ->
      dict:fold( fun(Dcid, Time2, Result) ->
                         case dict:find(Dcid, V1) of
                             {ok, Time1} ->
                                 case Time1 =:= Time2 of
                                     true ->
                                         Result;
                                     false ->
                                         false
                                 end;
                             error ->
                                 false
                         end
                 end,
                 true, V2).
  
  le(V1, V2) ->
      dict:fold( fun(Dcid, Time2, Result) ->
                         case dict:find(Dcid, V1) of
                             {ok, Time1} ->
                                 case Time1 =< Time2 of
                                     true ->
                                         Result;
                                     false ->
                                         false
                                 end;
                             error ->
                                 Result
                         end
                 end,
                 true, V2).
  
  ge(V1,V2) ->
      dict:fold( fun(Dcid, Time2, Result) ->
                         case dict:find(Dcid, V1) of
                             {ok, Time1} ->
                                 case Time1 >= Time2 of
                                     true ->
                                         Result;
                                     false ->
                                         false
                                 end;
                             error ->
                                 false
                         end
                 end,
                 true, V2).
  
  lt(V1,V2) ->
      dict:fold( fun(Dcid, Time2, Result) ->
                         case dict:find(Dcid, V1) of
                             {ok, Time1} ->
                                 case Time1 < Time2 of
                                     true ->
                                         Result;
                                     false ->
                                         false
                                 end;
                             error ->
                                 Result
                         end
                 end,
                 true, V2).
  
  gt(V1,V2) ->
      dict:fold( fun(Dcid, Time2, Result) ->
                         case dict:find(Dcid, V1) of
                             {ok, Time1} ->
                                 case Time1 > Time2 of
                                     true ->
                                         Result;
                                     false ->
                                         false
                                 end;
                             error ->
                                 false
                         end
                 end,
                 true, V2).
  
  strict_ge(V1,V2) ->
      ge(V1,V2) and (not eq(V1,V2)).
  
  strict_le(V1,V2) ->
      le(V1,V2) and (not eq(V1,V2)).
  
  -ifdef(TEST).
  
  vectorclock_test() ->
      V1 = vectorclock:from_list([{1,5},{2,4},{3,5},{4,6}]),
      V2 = vectorclock:from_list([{1,4}, {2,3}, {3,4},{4,5}]),
      V3 = vectorclock:from_list([{1,5}, {2,4}, {3,4},{4,5}]),
      V4 = vectorclock:from_list([{1,6},{2,3},{3,1},{4,7}]),
      V5 = vectorclock:from_list([{1,6},{2,7}]),
      ?assertEqual(gt(V1,V2), true),
      ?assertEqual(lt(V2,V1), true),
      ?assertEqual(gt(V1,V3), false),
      ?assertEqual(strict_ge(V1,V3), true),
      ?assertEqual(strict_ge(V1,V1), false),
      ?assertEqual(ge(V1,V4), false),
      ?assertEqual(le(V1,V4), false),
      ?assertEqual(eq(V1,V4), false),
      ?assertEqual(ge(V1,V5), false).
  
  -endif.
  