anchor.diff:  
   -export([lookup/1
            ,lookup_by_channel/1
  +         ,lookup_ids_by_channel/1
           ]).
   
   -export([id/1
  
positive.code: new_token_id() ->
      iolist_to_binary(["t.", uuid:to_iolist(uuid:v4())]).
  
  lookup_by_channel(ChannelId) when is_integer(ChannelId) ->
      Ids = [ Id
              || #token_idx{id = Id} <- ets:lookup(?CHAN_TOKEN_TAB, ChannelId)],
      lists:flatmap(fun (Id) ->
                            ets:lookup(?TOKEN_TAB, Id)
                    end,
                    Ids).
  
  store(#token{id=Token,
               channel_id=ChannelId,
  
negative.code:     ets:delete(?TOKEN_TAB, Id),
      ets:delete_object(?CHAN_TOKEN_TAB, index_rec(Token)).
  
  delete_by_channel(ChannelId) when is_integer(ChannelId) ->
      [ ets:delete(?TOKEN_TAB, Id)
        || #token_idx{id = Id} <- lookup_ids_by_channel(ChannelId) ],
      ets:delete(?CHAN_TOKEN_TAB, ChannelId).
  
  lookup_ids_by_channel(ChannelId) when is_integer(ChannelId) ->
      [ Id
        || #token_idx{id = Id} <- ets:lookup(?CHAN_TOKEN_TAB, ChannelId) ].
  
  index_rec(#token{id = Id, channel_id = Chan}) ->
      #token_idx{channel_id = Chan, id = Id}.
  