anchor.diff:  terminate(_Reason, _State) ->
       ok.
   
  +
  +%% @doc Obtains, from an orddict of Snapshots, the latest snapshot that can be included in 
  +%% a snapshot identified by SnapshotTime
   -spec get_latest_snapshot(SnapshotDict::orddict:orddict(), SnapshotTime::vectorclock:vectorclock())
   	 -> {ok, term()}.
   get_latest_snapshot(SnapshotDict, SnapshotTime) ->
  
positive.code:             	[]->
              	    Snapshot=LatestSnapshot;
              	[H|T]->
              		LastOp=lists:last([H|T]),
              		TxId = LastOp#clocksi_payload.txid,
  					{ok, Snapshot} = clocksi_materializer:update_snapshot(Type, LatestSnapshot, SnapshotTime, [H|T], TxId),
  					CommitTime = LastOp#clocksi_payload.commit_time,
  					lager:info("previous snapshots are = ~p, ",[SnapshotDict]),
  					lager:info("materialiser_vnode: caching new snapshot= ~p, snapshot committed with time:~p.", [Snapshot,CommitTime]),
  					lager:info("previous snapshots are = ~p, ",[orddict:store(CommitTime,Snapshot, SnapshotDict)]),
  					ets:insert(SnapshotCache, {Key, snapshot_gc(orddict:store(CommitTime,Snapshot, SnapshotDict))}),
  					lager:info("new snapshots are = ~p, ",[ets:lookup(SnapshotCache, Key)])
  				end
              end
  
negative.code: -include_lib("riak_core/include/riak_core_vnode.hrl").
  
  
  -define(SNAPSHOT_THRESHOLD, 3).
  -define(SNAPSHOT_MIN, 2).
  -define(OPS_THRESHOLD, 50).
  -define(OPS_MIN, 5).
  