anchor.diff:      {ok, Storage} = dets:open_file(storage, [
               {file, ?GV(storage, Settings, ?DEFAULT_STORAGE)},
               {ram_file, true}]),
  +    WorkIdFile = ?GV(work_id, Settings, ?DEFAULT_WORK_ID_FILE),
  +    WorkId = get_work_id(WorkIdFile),
       async_register(),
  -    {ok, #state{storage=Storage, registered=false}}.
  +    {ok, #state{
  +            storage=Storage,
  +            registered=false,
  +            work_id=WorkId,
  +            work_id_file=WorkIdFile}}.
   
   
   handle_call(storage_list_packages, From, State) ->
  
positive.code: -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
           terminate/2, code_change/3]).
  
  -record(state, {storage='storage', registered=false, work_id=0}).
  
  start_link() ->
      gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
  
negative.code: 
  async_register(Delay) ->
      erlang:send_after(Delay, self(), async_register).
  
  get_work_id(File) ->
      case file:consult(File) of
          {ok, [Id]} when is_integer(Id) ->
              Id;
          _Other ->
              update_work_id(File, 0)
      end.
  
  update_work_id(File, Id) when is_integer(Id) ->
      BStrId = list_to_binary(io_lib:format("~B.", [Id])),
      {ok, Fd} = file:open(File, [write]),
      file:write(Fd, BStrId),
      file:close(Fd),
      Id.
  