diff options
author | Nick Vatamaniuc <vatamane@gmail.com> | 2021-04-14 01:45:51 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2021-04-16 17:44:43 -0400 |
commit | 9ac2ae5bd15954ee389d9bd556cde1be9e0b6694 (patch) | |
tree | 2efb817441d4159dbc7f754bf5039f3ee72356ec | |
parent | 93cd8b5ecffadb7109320405ab623e044350bafe (diff) | |
download | couchdb-9ac2ae5bd15954ee389d9bd556cde1be9e0b6694.tar.gz |
Update couch_util to remove couch_db and mem3 calls
Also remove the with_db/2 function as it's not used any longer
-rw-r--r-- | src/couch/src/couch_util.erl | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl index 8d643398c..af7b7ff0a 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}), |