summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-05-27 12:46:15 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-05-27 12:46:56 -0400
commit200d64d61d209599a1f32b954605c46abacd45bc (patch)
tree58b7fe5a78f83f08a89df2a0063dffc05096652d
parentcad5e1f1ef75c2338171916b7cb76549a2f6ffad (diff)
open_doc call in fabric
-rw-r--r--ebin/fabric.app3
-rw-r--r--src/fabric_util.erl24
2 files changed, 22 insertions, 5 deletions
diff --git a/ebin/fabric.app b/ebin/fabric.app
index 7e425a03..cd81b383 100644
--- a/ebin/fabric.app
+++ b/ebin/fabric.app
@@ -11,7 +11,8 @@
fabric_info,
fabric_open,
fabric_rpc,
- fabric_util
+ fabric_util,
+ fabric_doc
]},
{registered, []},
{included_applications, []},
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}),