anchor.diff:  %% Function: start_link() -> {ok,Pid} | ignore | {error,Error}
   %% Description: Starts the server
   %%--------------------------------------------------------------------
  +-spec start_link() -> ignore | {ok, pid()} | {error, any()}.
   start_link() ->
       gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
   
  
positive.code: %% Description: Remove a chunk in the endgame from its assignment to a
  %%   given pid
  %%--------------------------------------------------------------------
  endgame_remove_chunk(Pid, Id, {Index, Offset, Len}) ->
      gen_server:call(?SERVER, {endgame_remove_chunk, Pid, Id, {Index, Offset, Len}}).
  
  %% Description: Return some chunks for downloading.
  %%
  %%   This function is relying on tail-calls to itself with different
  %%   tags to return the needed data.
  %%
  %%--------------------------------------------------------------------
  pick_chunks(_Pid, _Id, unknown, _N) ->
      none_eligible;
  pick_chunks(Pid, Id, Set, N) ->
  
negative.code: %%        IOL ::= {integer(), integer(), integer()} - {Index, Offs, Len}
  %% Description: Mark a given chunk as fetched.
  %%--------------------------------------------------------------------
  -spec mark_fetched(integer(), {integer(), integer(), integer()}) -> found | assigned.
  mark_fetched(Id, {Index, Offset, Len}) ->
      gen_server:call(?SERVER, {mark_fetched, Id, Index, Offset, Len}).
  
  % @doc Store the chunk in the chunk table. As a side-effect, check the piece if it
  % is fully fetched.
  -spec store_chunk(integer(), {integer(), binary(), term()}, {integer(), integer()}, pid()) ->
                  ok.
  store_chunk(Id, {Index, D, Ops}, {Offset, Len}, FSPid) ->
      gen_server:call(?SERVER, {store_chunk, Id, {Index, D, Ops}, {Offset, Len}, FSPid},
                     timer:seconds(?STORE_CHUNK_TIMEOUT)).
  