Anonymous avatar Anonymous committed 210375d

update delete to match new ReqId scheme

Comments (0)

Files changed (1)

src/riak_delete.erl

 
 -module(riak_delete).
 
--export([delete/5]).
+-export([delete/6]).
 
 %% @spec delete(riak_object:bucket(), riak_object:key(), RW :: integer(),
 %%              TimeoutMillisecs :: integer(), Client :: pid()) -> term()
 %% @doc Delete the object at Bucket/Key.  Direct return value is uninteresting,
 %%      see riak_client:delete/3 for expected gen_server replies to Client.
-delete(Bucket,Key,RW,Timeout,Client) ->           
+delete(ReqId,Bucket,Key,RW,Timeout,Client) ->           
     RealStartTime = riak_util:moment(),
-    ReqID = erlang:phash2({random:uniform(),self(),Bucket,Key,RealStartTime}),
-    riak_eventer:notify(riak_delete, delete_start, {ReqID, Bucket, Key}),
+    riak_eventer:notify(riak_delete, delete_start, {ReqId, Bucket, Key}),
     {ok,C} = riak:local_client(),
     case C:get(Bucket,Key,RW,Timeout) of
         {ok, OrigObj} ->
             case Reply of
                 ok -> 
                     spawn(
-                      fun()-> reap(Bucket,Key,RemainingTime,Timeout,ReqID) end);
+                      fun()-> reap(Bucket,Key,RemainingTime,Timeout,ReqId) end);
                 _ -> nop
             end,
-            riak_eventer:notify(riak_delete, delete_reply, {ReqID, Reply}),
-            Client ! Reply;
+            riak_eventer:notify(riak_delete, delete_reply, {ReqId, Reply}),
+            Client ! {ReqId, Reply};
         {error, notfound} ->
             riak_eventer:notify(riak_delete, delete_reply,
-                                {ReqID, {error, notfound}}),
-            Client ! {error, notfound};
+                                {ReqId, {error, notfound}}),
+            Client ! {ReqId, {error, notfound}};
         X ->
-            riak_eventer:notify(riak_delete, delete_reply, {ReqID, X}),
-            Client ! X
+            riak_eventer:notify(riak_delete, delete_reply, {ReqId, X}),
+            Client ! {ReqId, X}
     end.
 
 reap(Bucket, Key, WaitTime, Timeout, ReqId) ->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.