You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2021/04/16 21:45:18 UTC
[couchdb] 13/24: Update couch_util to remove couch_db and mem3 calls
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 9ac2ae5bd15954ee389d9bd556cde1be9e0b6694
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Wed Apr 14 01:45:51 2021 -0400
Update couch_util to remove couch_db and mem3 calls
Also remove the with_db/2 function as it's not used any longer
---
src/couch/src/couch_util.erl | 26 +++-----------------------
1 file changed, 3 insertions(+), 23 deletions(-)
diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl
index 8d64339..af7b7ff 100644
--- a/src/couch/src/couch_util.erl
+++ b/src/couch/src/couch_util.erl
@@ -28,7 +28,6 @@
-export([url_strip_password/1]).
-export([encode_doc_id/1]).
-export([normalize_ddoc_id/1]).
--export([with_db/2]).
-export([rfc1123_date/0, rfc1123_date/1]).
-export([integer_to_boolean/1, boolean_to_integer/1]).
-export([validate_positive_int/1]).
@@ -260,9 +259,9 @@ json_apply_field({Key, NewValue}, [], Acc) ->
{[{Key, NewValue}|Acc]}.
json_user_ctx(Db) ->
- ShardName = couch_db:name(Db),
- Ctx = couch_db:get_user_ctx(Db),
- {[{<<"db">>, mem3:dbname(ShardName)},
+ #{name := DbName} = Db,
+ Ctx = fabric2_db:get_user_ctx(Db),
+ {[{<<"db">>, DbName},
{<<"name">>,Ctx#user_ctx.name},
{<<"roles">>,Ctx#user_ctx.roles}]}.
@@ -565,25 +564,6 @@ normalize_ddoc_id(<<"_design/", _/binary>> = DDocId) ->
normalize_ddoc_id(DDocId) when is_binary(DDocId) ->
<<"_design/", DDocId/binary>>.
-with_db(DbName, Fun) when is_binary(DbName) ->
- case couch_db:open_int(DbName, [?ADMIN_CTX]) of
- {ok, Db} ->
- try
- Fun(Db)
- after
- catch couch_db:close(Db)
- end;
- Else ->
- throw(Else)
- end;
-with_db(Db, Fun) ->
- case couch_db:is_db(Db) of
- true ->
- Fun(Db);
- false ->
- erlang:error({invalid_db, Db})
- end.
-
rfc1123_date() ->
{{YYYY,MM,DD},{Hour,Min,Sec}} = calendar:universal_time(),
DayNumber = calendar:day_of_the_week({YYYY,MM,DD}),