Repository: couchdb-fabric
Updated Branches:
  refs/heads/master 86995c5aa -> d89e00929


Use ADMIN_CTX macro from couch_db.hrl


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/d89e0092
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/d89e0092
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/d89e0092

Branch: refs/heads/master
Commit: d89e009291d783a2762143e4eb22e6d8119cceed
Parents: 86995c5
Author: Alexander Shorin <[email protected]>
Authored: Mon Jan 26 07:11:54 2015 +0300
Committer: Alexander Shorin <[email protected]>
Committed: Mon Jan 26 07:11:54 2015 +0300

----------------------------------------------------------------------
 src/fabric.erl               | 2 --
 src/fabric_db_meta.erl       | 3 +--
 src/fabric_doc_open.erl      | 3 +--
 src/fabric_doc_open_revs.erl | 3 +--
 4 files changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/d89e0092/src/fabric.erl
----------------------------------------------------------------------
diff --git a/src/fabric.erl b/src/fabric.erl
index ea07fbe..55fb1e8 100644
--- a/src/fabric.erl
+++ b/src/fabric.erl
@@ -16,8 +16,6 @@
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("couch_mrview/include/couch_mrview.hrl").
 
--define(ADMIN_CTX, {user_ctx, #user_ctx{roles = [<<"_admin">>]}}).
-
 % DBs
 -export([all_dbs/0, all_dbs/1, create_db/1, create_db/2, delete_db/1,
     delete_db/2, get_db_info/1, get_doc_count/1, set_revs_limit/3,

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/d89e0092/src/fabric_db_meta.erl
----------------------------------------------------------------------
diff --git a/src/fabric_db_meta.erl b/src/fabric_db_meta.erl
index 1550062..a0f1b5f 100644
--- a/src/fabric_db_meta.erl
+++ b/src/fabric_db_meta.erl
@@ -125,9 +125,8 @@ get_all_security(DbName, Options) ->
         Shards0 when is_list(Shards0) -> Shards0;
         _ -> mem3:shards(DbName)
     end,
-    Admin = [{user_ctx, #user_ctx{roles = [<<"_admin">>]}}],
     RexiMon = fabric_util:create_monitors(Shards),
-    Workers = fabric_util:submit_jobs(Shards, get_all_security, [Admin]),
+    Workers = fabric_util:submit_jobs(Shards, get_all_security, [?ADMIN_CTX]),
     Handler = fun handle_get_message/3,
     Acc = #acc{
         workers=Workers,

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/d89e0092/src/fabric_doc_open.erl
----------------------------------------------------------------------
diff --git a/src/fabric_doc_open.erl b/src/fabric_doc_open.erl
index ce9e5ff..c7d90a4 100644
--- a/src/fabric_doc_open.erl
+++ b/src/fabric_doc_open.erl
@@ -120,8 +120,7 @@ read_repair(#acc{dbname=DbName, replies=Replies}) ->
     [#doc{id = <<?LOCAL_DOC_PREFIX, _/binary>>} | _] ->
         choose_reply(Docs);
     [#doc{id=Id} | _] ->
-        Ctx = #user_ctx{roles=[<<"_admin">>]},
-        Opts = [replicated_changes, {user_ctx, Ctx}],
+        Opts = [replicated_changes, ?ADMIN_CTX],
         Res = fabric:update_docs(DbName, Docs, Opts),
         case Res of
             {ok, []} ->

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/d89e0092/src/fabric_doc_open_revs.erl
----------------------------------------------------------------------
diff --git a/src/fabric_doc_open_revs.erl b/src/fabric_doc_open_revs.erl
index 0a30afc..6295b07 100644
--- a/src/fabric_doc_open_revs.erl
+++ b/src/fabric_doc_open_revs.erl
@@ -170,8 +170,7 @@ maybe_execute_read_repair(_Db, false) ->
     ok;
 maybe_execute_read_repair(Db, Docs) ->
     [#doc{id=Id} | _] = Docs,
-    Ctx = #user_ctx{roles=[<<"_admin">>]},
-    Res = fabric:update_docs(Db, Docs, [replicated_changes, {user_ctx,Ctx}]),
+    Res = fabric:update_docs(Db, Docs, [replicated_changes, ?ADMIN_CTX]),
     case Res of
         {ok, []} ->
             couch_stats:increment_counter([fabric, read_repairs, success]);

Reply via email to