anchor.diff:        end).
   
   
  -%%--------------------------------------------------------------------
  -%% Function: statechange(Id, What) -> ok
  -%% Description: Alter the state of the Tracking map identified by Id
  -%%   by What (see alter_map/2).
  -%%--------------------------------------------------------------------
  +% @doc Alter the state of the Tracking map identified by Id
  +%   <p>by What (see alter_map/2).</p>
  +% @end
  +-type alteration() :: {infohash, binary()} | started | stopped.
  +-spec statechange(integer(), alteration()) -> ok.
   statechange(Id, What) ->
       F = fun () ->
                   [TM] = mnesia:read(tracking_map, Id, write),
  
positive.code: 
  -define(SERVER, ?MODULE).
  
  %%====================================================================
  %% API
  %%====================================================================
  start_link() ->
      gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
  
  
  %%--------------------------------------------------------------------
  %% Function: new(Filename, Supervisor) -> ok
  %% Description: Add a new torrent given by File with the Supervisor
  %%   pid as given to the database structure.
  %%--------------------------------------------------------------------
  new(File, Supervisor, Id) when is_integer(Id), is_pid(Supervisor), is_list(File) ->
      gen_server:call(?SERVER, {new, File, Supervisor, Id}).
  
  
  %%--------------------------------------------------------------------
  %% Function: all/0
  %% Description: Return everything we are currently tracking
  %%--------------------------------------------------------------------
  all() ->
      mnesia:transaction(
        fun () ->
                qlc:e(qlc:q([T || T <- mnesia:table(tracking_map)]))
        end).
  
  %%--------------------------------------------------------------------
  %% Function: select(Id) -> [#tracking_map]
  %% Args:    Id ::= integer() | {filename, FN} | {infohash, IH}
  %%
  %%          FN ::= string()
  %%          IH ::= binary()
  %% Description: Find tracking map matching the filename in question.
  %%--------------------------------------------------------------------
  select(Id) when is_integer(Id) ->
      mnesia:transaction(
        fun () ->
  
negative.code:     {atomic, _} = mnesia:transaction(F),
      ok.
  
  % @doc Attempt to mark the torrent for checking.
  %  <p>If this succeeds, returns true, else false</p>
  % @end
  -spec is_ready_for_checking(integer()) -> boolean().
  is_ready_for_checking(Id) ->
      F = fun () ->
                  Q = qlc:q([TM || TM <- mnesia:table(tracking_map),
  