summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-09 21:18:47 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-06-09 21:18:53 -0400
commita8fc23d74b3ddfc44bacbd1c82389e2150234ff7 (patch)
tree856d48c82420399843ede80c4b4e732db539887f /src
parent5b4205315fd9b1c0745974705c67c68e0cb1c8a7 (diff)
map and reduce views working over HTTP now, too
Diffstat (limited to 'src')
-rw-r--r--src/fabric.erl4
-rw-r--r--src/fabric_view_map.erl5
-rw-r--r--src/fabric_view_reduce.erl5
3 files changed, 10 insertions, 4 deletions
diff --git a/src/fabric.erl b/src/fabric.erl
index c3a858ce..dcd751a9 100644
--- a/src/fabric.erl
+++ b/src/fabric.erl
@@ -80,8 +80,8 @@ query_view(DbName, DesignName, ViewName, QueryArgs) ->
Callback = fun default_callback/2,
query_view(DbName, DesignName, ViewName, QueryArgs, Callback, []).
-query_view(DbName, DesignName, ViewName, QueryArgs, Callback, Acc0) ->
- Db = dbname(DbName), Design = name(DesignName), View = name(ViewName),
+query_view(DbName, Design, ViewName, QueryArgs, Callback, Acc0) ->
+ Db = dbname(DbName), View = name(ViewName),
case is_reduce_view(Db, Design, View, QueryArgs) of
true ->
Mod = fabric_view_reduce;
diff --git a/src/fabric_view_map.erl b/src/fabric_view_map.erl
index e152c2ed..c314586c 100644
--- a/src/fabric_view_map.erl
+++ b/src/fabric_view_map.erl
@@ -4,8 +4,11 @@
-include("fabric.hrl").
-go(DbName, GroupId, View, Args, Callback, Acc0) ->
+go(DbName, GroupId, View, Args, Callback, Acc0) when is_binary(GroupId) ->
{ok, DDoc} = fabric:open_doc(DbName, <<"_design/", GroupId/binary>>, []),
+ go(DbName, DDoc, View, Args, Callback, Acc0);
+
+go(DbName, DDoc, View, Args, Callback, Acc0) ->
Workers = lists:map(fun(#shard{name=Name, node=Node} = Shard) ->
Ref = rexi:cast(Node, {fabric_rpc, map_view, [Name, DDoc, View, Args]}),
Shard#shard{ref = Ref}
diff --git a/src/fabric_view_reduce.erl b/src/fabric_view_reduce.erl
index 73395d8c..9514bdef 100644
--- a/src/fabric_view_reduce.erl
+++ b/src/fabric_view_reduce.erl
@@ -4,8 +4,11 @@
-include("fabric.hrl").
-go(DbName, GroupId, VName, Args, Callback, Acc0) ->
+go(DbName, GroupId, View, Args, Callback, Acc0) when is_binary(GroupId) ->
{ok, DDoc} = fabric:open_doc(DbName, <<"_design/", GroupId/binary>>, []),
+ go(DbName, DDoc, View, Args, Callback, Acc0);
+
+go(DbName, DDoc, VName, Args, Callback, Acc0) ->
#group{def_lang=Lang, views=Views} = Group =
couch_view_group:design_doc_to_view_group(#db{name=DbName}, DDoc),
{NthRed, View} = fabric_view:extract_view(nil, VName, Views, reduce),