summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-09 15:36:58 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-06-09 15:36:58 -0400
commit00e161c34b6fc71c09ffe376d6c8b9512814216a (patch)
treeaa6f254b4f68944b895ab41433b891340c201121
parenta4cd71dec2ca37cfca9a7ac15b3ff31f47cd11d7 (diff)
bunch o' updates
- fabric view group info - send user_ctx to fabric on update_docs requests - send 403s for compaction and view cleanup
-rw-r--r--ebin/fabric.app1
-rw-r--r--src/fabric.erl6
-rw-r--r--src/fabric_rpc.erl6
-rw-r--r--src/fabric_view_map.erl4
-rw-r--r--src/fabric_view_reduce.erl2
5 files changed, 14 insertions, 5 deletions
diff --git a/ebin/fabric.app b/ebin/fabric.app
index 9c26b635..b93387a4 100644
--- a/ebin/fabric.app
+++ b/ebin/fabric.app
@@ -16,6 +16,7 @@
fabric_doc_open,
fabric_doc_open_revs,
fabric_doc_update,
+ fabric_group_info,
fabric_rpc,
fabric_util,
fabric_view,
diff --git a/src/fabric.erl b/src/fabric.erl
index 80c9614e..c3a858ce 100644
--- a/src/fabric.erl
+++ b/src/fabric.erl
@@ -9,7 +9,8 @@
update_docs/3, att_receiver/2]).
% Views
--export([all_docs/4, changes/3, query_view/3, query_view/4, query_view/6]).
+-export([all_docs/4, changes/3, query_view/3, query_view/4, query_view/6,
+ get_view_group_info/2]).
% miscellany
-export([db_path/2, design_docs/1]).
@@ -89,6 +90,9 @@ query_view(DbName, DesignName, ViewName, QueryArgs, Callback, Acc0) ->
end,
Mod:go(Db, Design, View, QueryArgs, Callback, Acc0).
+get_view_group_info(DbName, DesignId) ->
+ fabric_group_info:go(dbname(DbName), name(DesignId)).
+
design_docs(DbName) ->
QueryArgs = #view_query_args{start_key = <<"_design/">>, include_docs=true},
Callback = fun({total_and_offset, _, _}, []) ->
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index f1f84ed5..49e61370 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -2,7 +2,7 @@
-export([get_db_info/1, get_doc_count/1, get_update_seq/1]).
-export([open_doc/3, open_revs/4, get_missing_revs/2, update_docs/3]).
--export([all_docs/2, changes/3, map_view/4, reduce_view/4]).
+-export([all_docs/2, changes/3, map_view/4, reduce_view/4, group_info/2]).
-include("fabric.hrl").
@@ -180,6 +180,10 @@ update_docs(DbName, Docs, Options) ->
end,
with_db(DbName, Options, {couch_db, update_docs, [Docs, Options, X]}).
+group_info(DbName, Group0) ->
+ {ok, Pid} = gen_server:call(couch_view, {get_group_server, DbName, Group0}),
+ rexi:reply(couch_view_group:request_group_info(Pid)).
+
%%
%% internal
%%
diff --git a/src/fabric_view_map.erl b/src/fabric_view_map.erl
index b20a0f39..e152c2ed 100644
--- a/src/fabric_view_map.erl
+++ b/src/fabric_view_map.erl
@@ -1,10 +1,10 @@
-module(fabric_view_map).
--export([go/5]).
+-export([go/6]).
-include("fabric.hrl").
-go(DbName, {GroupId, View}, Args, Callback, Acc0) ->
+go(DbName, GroupId, View, Args, Callback, Acc0) ->
{ok, DDoc} = fabric:open_doc(DbName, <<"_design/", GroupId/binary>>, []),
Workers = lists:map(fun(#shard{name=Name, node=Node} = Shard) ->
Ref = rexi:cast(Node, {fabric_rpc, map_view, [Name, DDoc, View, Args]}),
diff --git a/src/fabric_view_reduce.erl b/src/fabric_view_reduce.erl
index 0e52ec84..af92f98e 100644
--- a/src/fabric_view_reduce.erl
+++ b/src/fabric_view_reduce.erl
@@ -4,7 +4,7 @@
-include("fabric.hrl").
-go(DbName, {GroupId, VName}, Args, Callback, Acc0) ->
+go(DbName, GroupId, VName, Args, Callback, Acc0) ->
{ok, DDoc} = fabric:open_doc(DbName, <<"_design/", GroupId/binary>>, []),
#group{def_lang=Lang, views=Views} = Group =
couch_view_group:design_doc_to_view_group(#db{name=DbName}, DDoc),