anchor.diff:           terminate/2,
            code_change/3]).
   
  --record(state, {}).
  +-define(TIMEOUT, 60000).
  +
  +-record(state, {primary, secondary, third, timer, type, value, clock_hit, retentions, ratios}).
   
   %%%===================================================================
   %%% API
  
positive.code: %%%===================================================================
  
  init([Key, Type]) ->
      {ok, #state{}}.
  
  handle_call(_Request, _From, State) ->
      Reply = ok,
      {reply, Reply, State}.
  
  handle_cast(_Msg, State) ->
      {noreply, State}.
  
  handle_info(_Info, State) ->
      {noreply, State}.
  
  terminate(_Reason, _State) ->
      ok.
  
  code_change(_OldVsn, State, _Extra) ->
  
negative.code: %%%===================================================================
  %%% Internal functions
  %%%===================================================================
  get_path(Schema, Key) ->
      PrivDir = code:priv_dir(yasa),
      [PrivDir, "/", Schema, "/", Key].
  
  set_timer({Step, _Size}) ->
      erlang:start_timer(Step * 1000, self(), {clock, Step}).
  
  get_retention_ratios([{Step, _Size} | Tail]) ->
      Fun = fun({Step1, _}) -> Step1 / Step end,
      lists:map(Fun, Tail).
  
  push_into_queue(Value, Queue, Hit, Ratio) ->
      case Hit rem Ratio of
          0 -> insert();
          _ -> ok
      end.
  
  insert() -> ok.
  %%%% TODO actually write these function
  select_queue(Start, [H |Tail]) ->
      H.
  select_range_from_queue([H | Tail], Start, End) ->
      [H].