diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-05-27 12:46:15 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-05-27 12:46:56 -0400 |
commit | 200d64d61d209599a1f32b954605c46abacd45bc (patch) | |
tree | 58b7fe5a78f83f08a89df2a0063dffc05096652d /src | |
parent | cad5e1f1ef75c2338171916b7cb76549a2f6ffad (diff) |
open_doc call in fabric
Diffstat (limited to 'src')
-rw-r--r-- | src/fabric_util.erl | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/fabric_util.erl b/src/fabric_util.erl index 8eeaee33..98da1001 100644 --- a/src/fabric_util.erl +++ b/src/fabric_util.erl @@ -1,14 +1,30 @@ -module(fabric_util). --export([receive_loop/6]). +-export([receive_loop/4, receive_loop/6]). -include("../../dynomite/include/membership.hrl"). +submit_jobs(Shards, EndPoint, ExtraArgs) -> + lists:map(fun(#shard{node=Node, name=ShardName} = Shard) -> + Ref = rexi:cast(Node, {?RPC, EndPoint, [ShardName | ExtraArgs]}), + Shard#shard{ref = Ref} + end. + +recv(Workers, Keypos, Fun, Acc0) -> + receive_loop(Workers, Keypos, Fun, Acc0). + +receive_loop(Workers, Keypos, Fun, Acc0) -> + case couch_config:get("fabric", "request_timeout", "10000") of + "infinity" -> + Timeout = infinity; + N -> + Timeout = list_to_integer(N) + end, + receive_loop(Workers, Keypos, Fun, Acc0, Timeout, infinity). %% @doc set up the receive loop with an overall timeout --spec receive_loop([ref_part_map()], integer(), function(), any(), - integer(), integer()) -> - {ok, beg_acc()}. +-spec receive_loop([any()], integer(), function(), any(), timeout(), timeout()) -> + {ok, any()}. receive_loop(RefPartMap, Keypos, Fun, Acc0, GlobalTimeout, PerMsgTO) -> TimeoutRef = erlang:make_ref(), {ok, TRef} = timer:send_after(GlobalTimeout, {timeout, TimeoutRef}), |