anchor.diff:  
   
   %%---------------- Internal Functions -------------------%%
  -
  --spec internal_get_ops(key(), type(),clock_time(), snapshot_time(),dcid(),#mat_state{}) -> {ok, [clocksi_payload()]}.
  -internal_get_ops(Key, Type, MinTime, SnapshotTime, DCID, _MatState = #mat_state{ops_cache = OpsCache, snapshot_cache=SnapshotCache}) ->
  -    %% First get the oldest snapshot in the cache
  -    Result = case ets:lookup(SnapshotCache, Key) of
  -		 [] ->
  -		     %% First time reading this key, store an empty snapshot in the cache
  -		     BlankSS = #materialized_snapshot{last_op_id = 0, value = clocksi_materializer:new(Type)},
  -		     materializer_vnode:store_ss(Key,BlankSS,vectorclock:new()),
  -		     {BlankSS,ignore};
  -		 [{_, SnapshotDict}] ->
  -		     case vector_orddict:get_smaller_from_id(DCID, MinTime, SnapshotDict) of
  -			 undefined ->
  -			     lager:info("no snapshot found"),
  -			     {error, no_snapshot};
  -			 {SnapshotCommitTime, LatestSnapshot} ->
  -			     lager:info("Found the snapshot ~p", [{SnapshotCommitTime,LatestSnapshot}]),
  -			     {LatestSnapshot,SnapshotCommitTime}
  -		     end
  -	     end,
  -    SnapshotGetRespPrev = 
  -	case Result of
  -	    {error, no_snapshot} ->
  -		LogId = log_utilities:get_logid_from_key(Key),
  -		[Node] = log_utilities:get_preflist_from_key(Key),
  -		MinSnapshotTime = vectorclock:set_clock_of_dc(DCID, MinTime, vectorclock:new()),
  -		logging_vnode:get_range(Node, LogId, MinSnapshotTime, SnapshotTime, Type, Key);
  -	    {LatestSnapshot1,SnapshotCommitTime1} ->
  -		case ets:lookup(OpsCache, Key) of
  -		    [] ->
  -			lager:info("no ops in the SS"),
  -			#snapshot_get_response{number_of_ops = 0, ops_list = [],
  -					       materialized_snapshot = LatestSnapshot1,
  -					       snapshot_time = SnapshotCommitTime1, is_newest_snapshot = false};
  -		    [Tuple] ->
  -			{Key,Length1,_OpId,_ListLen,AllOps} = tuple_to_key(Tuple,true),
  -			lager:info("found the ops in the SS ~p", [length(AllOps)]),
  -			#snapshot_get_response{number_of_ops = Length1, ops_list = AllOps,
  -					       materialized_snapshot = LatestSnapshot1,
  -					       snapshot_time = SnapshotCommitTime1, is_newest_snapshot = false}
  -		end
  -	end,
  -    {ok, SnapshotGetRespPrev#snapshot_get_response.ops_list}.
   
   -spec internal_store_ss(key(), #materialized_snapshot{}, snapshot_time(), boolean(), #mat_state{}) -> boolean().
   internal_store_ss(Key,Snapshot = #materialized_snapshot{last_op_id = NewOpId},CommitTime,ShouldGc,State = #mat_state{snapshot_cache=SnapshotCache}) ->
  
positive.code: 	    {error, no_snapshot} ->
  		LogId = log_utilities:get_logid_from_key(Key),
  		[Node] = log_utilities:get_preflist_from_key(Key),
  		Res = logging_vnode:get_up_to_time(Node, LogId, MinSnapshotTime, Type, Key),
  		Res;
  	    {LatestSnapshot1,SnapshotCommitTime1,IsFirst1} ->
  		case ets:lookup(OpsCache, Key) of
  		    [] ->
  
negative.code: 	end,
      {Key,Length,OpId,ListLen,Ops}.
  tuple_to_key_int(Next,Next,_Tuple,Acc) ->
      Acc;
  tuple_to_key_int(Next,Last,Tuple,Acc) ->
      tuple_to_key_int(Next+1,Last,Tuple,[element(Next,Tuple)|Acc]).
  
  