anchor.diff:  %% @end
   %%--------------------------------------------------------------------
   -spec parallel_apply([{datastore:key(),
  -    [datastore:doc()]}], reference()) -> ok.
  +    [datastore:doc()]}], reference()) -> [pid()].
   parallel_apply(DocsList, Ref) ->
       Master = self(),
  -    Pids = lists:map(fun({_, DocList}) ->
  -        % TODO - sprawdzac pidy czy dzialaja
  +    lists:map(fun({_, DocList}) ->
           spawn(fun() ->
               SlaveAns = lists:foldl(fun
                   (Doc, ok) ->
  
positive.code:                 (_, Acc) ->
                      Acc
              end, ok, lists:reverse(DocList)),
              Master ! {changes_worker_ans, Ref, SlaveAns}
          end)
      end, DocsList).
  
  
negative.code: %% Gather appropriate number of workers' answers.
  %% @end
  %%--------------------------------------------------------------------
  -spec gather_answers(list(), reference(),
      ok | {error, datastore:seq(), term()}) ->
      ok | timeout | {error, datastore:seq(), term()}.
  gather_answers([], _Ref, Ans) ->
      Ans;
  gather_answers(Pids, Ref, TmpAns) ->
      receive
          {changes_worker_ans, Ref, Pid, Ans} ->
              Merged = case {Ans, TmpAns} of
                  {ok, _} -> TmpAns;
                  {{error, Seq, _}, {error, Seq2, _}} when Seq < Seq2 -> Ans;
                  {{error, _, _}, {error, _, _}} -> TmpAns;
                  _ -> Ans
              end,
              gather_answers(Pids -- [Pid], Ref, Merged)
      after
          ?WORKER_TIMEOUT ->
              IsAnyAlive = lists:foldl(fun
                  (_, true) ->
                      true;
                  (Pid, _Acc) ->
                      erlang:is_process_alive(Pid)
              end, false, Pids),
              case IsAnyAlive of
                  true ->
                      gather_answers(Pids, Ref, TmpAns);
                  false ->
                      timeout
              end
      end.