anchor.diff:  
   -define(NUM_SAMPLES, 61).
   
  --record(state, {bucket, samples}).
  +-record(state, {bucket, samples, table}).
   
   -export([start_link/1,
            latest/2, latest/3, latest/4,
  
positive.code:     {reply, ringbuffer:to_list(N, Samples), State}.
  
  
  handle_cast(unhandled, unhandled) ->
      unhandled.
  
  
  handle_info({stats, Bucket, Sample}, State = #state{bucket=Bucket,
                                                     samples=Samples}) ->
      gen_event:notify(ns_stats_event, {sample_archived, Bucket, Sample}),
      {noreply, State#state{samples=ringbuffer:add(Sample,
                                                   Samples)}}.
  
  
  terminate(_Reason, _State) ->
      ok.
  
  
  %% Internal functions
  
  server(Bucket) ->
      list_to_atom(?MODULE_STRING ++ "-" ++ Bucket).
  
negative.code:          terminate/2]).
  
  
  %%
  %% API
  %%
  
  start_link(Bucket) ->
      gen_server:start_link({local, server(Bucket)}, ?MODULE, Bucket, []).
  
  
  %% @doc Get the latest samples for a given interval from the archive
  latest(minute, Bucket) ->
      mnesia:activity(transaction,
                      fun () ->
                              Tab = table_name(Bucket),
                              Key = mnesia:last(table_name(Bucket)),
                              mnesia:read(Tab, Key)
                      end).
  
  
  latest(minute, Node, Bucket) when is_atom(Node), is_list(Bucket) ->
      gen_server:call({server(Bucket), Node}, latest);
  