anchor.diff:          {ReqId, {error, Reason}} -> {error, Reason}
       after Timeout ->
               {error, {timeout, Acc}}
  +    end.
  +
  +
  +%% @private
  +wait_for_mapred(ReqId, Timeout) ->
  +    wait_for_mapred(ReqId,Timeout,orddict:new()).
  +%% @private
  +wait_for_mapred(ReqId, Timeout, Acc) ->
  +    receive
  +        {ReqId, done} -> {ok, orddict:to_list(Acc)};
  +        {ReqId, {mapred,Phase,Res}} -> 
  +            wait_for_listkeys(ReqId,Timeout,orddict:append_list(Phase,Res,Acc));
  +        {ReqId, {error, Reason}} -> {error, Reason}
  +    after Timeout ->
  +            {error, {timeout, orddict:to_list(Acc)}}
  +    end.
  +
  +
  +%% Encode the map/reduce request using term to binary
  +%% @private
  +encode_mapred_req(Req) ->
  +    term_to_binary(Req).
  +
  +%% Decode a partial phase response 
  +%% @private
  +decode_mapred_resp(Data, <<"application/x-erlang-binary">>) ->
  +    try
  +        binary_to_term(Data)
  +    catch
  +        _:Error -> % On error, merge in with the other results
  +            [{error, Error}]
       end.
   
   %% ====================================================================
  
positive.code: 
  process_response(#rpbsetbucketreq{}, undefined,
                   rpbsetbucketresp, State) ->
      {reply, ok, State}.
        
  %%
  %% Called after sending a message - supports returning a
  
negative.code:     {reply, {ok, ReqId}, State};
  after_send(rpblistbucketsreq, {ReqId, _Client}, State) ->
      {reply, {ok, ReqId}, State};
  after_send(#rpbmapredreq{}, {ReqId, _Client}, State) ->
      {reply, {ok, ReqId}, State};
  after_send(_Req, _Ctx, State) ->
      {noreply, State}.
  
  