anchor.diff:    DocId = maps:get(id, Reply),
     NewRevId = maps:get(rev, Reply),
     true = maps:get(ok, Reply),
  -  {ok, DocId, NewRevId}.
  -
  -fold_by_id(_Db, _Fun, _Acc, _Opts) ->
  -  {error, not_implemented}.
  -
  -changes_since(BarrelId, Since, Fun, Acc) ->
  -  gen_server:call(?MODULE, {changes_since, BarrelId, Since, Fun, Acc}).
  -
  -revsdiff(_Db, _DocId, _RevIds) ->
  -  {error, not_implemented}.
  -
  -%% ----------
  -
  -
  --record(state, {dbid, hackney_ref, hackney_acc, first_seq, buffer=[]}).
  -
  -start_link() ->
  -  case gen_server:start_link({local, ?MODULE}, ?MODULE, [], []) of
  -    {ok, Pid} -> {ok, Pid};
  -    {error, {already_started, Pid}} -> {ok, Pid}
  -  end.
  -
  -stop() ->
  -  gen_server:call(?MODULE, stop).
  -
  -init(_) ->
  -  {ok, #state{}}.
  -
  -handle_call({start, DbRef, _}, _From, State) ->
  -  {_, DbId} = DbRef,
  -  Since = 0, % TODO: pass it in parameter
  -  gen_server:cast(?MODULE, {longpoll, DbRef, Since}),
  -  {reply, ok, State#state{dbid=DbId}};
  +  {reply, {ok, DocId, NewRevId}, State};
   
   handle_call({changes_since, {_, DbId}, Since, Fun, Acc}, _From,
               #state{dbid=DbId, first_seq=Since}=S) ->
  
positive.code: handle_info(_Info, State) -> {noreply, State}.
  
  %% default gen_server callbacks
  terminate(_Reason, #state{hackney_ref=undefined}) ->
    ok;
  terminate(_Reason, #state{hackney_ref=Ref}) ->
    ok = hackney:close(Ref),
    ok.
    
  code_change(_OldVsn, State, _Extra) -> {ok, State}.
  
  %% ----------
  
  fold_result(Fun, Acc, Results) ->
    Folder = fun(DocInfo, A) ->
  
negative.code:   req(Method, Url, Body);
  
  req(Method, Url, Body) ->
    PoolName = pool_name(Url),
    Options = [{timeout, 150000}, {max_connections, 20}, {pool, PoolName}],
    {ok, Code, _Headers, Ref} = hackney:request(Method, Url, [], Body, Options),
    {ok, Answer} = hackney:body(Ref),
    {Code, Answer}.
  
  
  pool_name(Url) ->
    [_,_,Host|_] = binary:split(Url,<<"/">>, [global]),
    PoolName = <<"pool-httpc-", Host/binary>>,
    binary_to_atom(PoolName, utf8).
  