anchor.diff:           status/1,
            callback/3]).
   
  +%% "Testing" backend API
  +%% -export([reset/0]).
  +
   -ifdef(TEST).
   -include_lib("eunit/include/eunit.hrl").
   -endif.
   
   -define(API_VERSION, 1).
  --define(CAPABILITIES, [async_fold]).
  -
  --record(state, {data_ref :: integer() | atom(),
  -                time_ref :: integer() | atom(),
  +-define(CAPABILITIES, [async_fold, indexes]).
  +
  +%% Macros for working with indexes
  +-define(SELECT_BATCH_SIZE, 100).
  +-define(EQ_MS(B,I,V), [{{{B,I,V,'_'},'_'},[],['$_']}]).
  +-define(KEY_RANGE_MS(B,L,H), [{{{B,'$1'},'_'},
  +                               [{'>=', '$1', L},
  +                                {'=<', '$1', H}],
  +                               ['$_']}]).
  +-define(RANGE_MS(B,I,L,H), [{{{B,I,'$1','$2'}, '_'},
  +                             [{'>=','$1',L},
  +                              {'=<','$1',H}],
  +                             ['$_']}]).
  +-define(DELETE_PTN(B,K), {{B,'_','_',K},'_'}).
  +
  +-record(state, {data_ref :: ets:tid(),
  +                index_ref :: ets:tid(),
  +                time_ref :: ets:tid(),
                   max_memory :: undefined | integer(),
                   used_memory=0 :: integer(),
                   ttl :: integer()}).
  
positive.code:          [
            {timeout, 60000,
             [?_assertEqual(true,
                           backend_eqc:test(?MODULE, true))]}
          ]}]}]}.
  
  setup() ->
      application:load(sasl),
  
negative.code: %% @private
  %% @doc Dump some entries if the max memory size has
  %% been breached.
  trim_data_table(MaxMemory, UsedMemory, _, _, _, Freed) when
        (UsedMemory - Freed) =< MaxMemory ->
      Freed;
  trim_data_table(MaxMemory, UsedMemory, DataRef, TimeRef, IndexRef, Freed) ->
      %% Delete the oldest object
      OldestSize = delete_oldest(DataRef, TimeRef, IndexRef),
      trim_data_table(MaxMemory,
                      UsedMemory,
                      DataRef,
                      TimeRef,
                      IndexRef,
                      Freed + OldestSize).
  
  %% @private
  delete_oldest(DataRef, TimeRef, IndexRef) ->
      OldestTime = ets:first(TimeRef),
      case OldestTime of
          '$end_of_table' ->
  