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:13 UTC
[couchdb] 08/24: Update couch_flags to remove knowledge about shards
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 d3176243a2adfef16b450d59ff99e5cd5a3d141d
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Wed Apr 14 00:24:56 2021 -0400
Update couch_flags to remove knowledge about shards
Remove shard handling from `couch_flags`.
`couch_db:normalize_dbname/1` call is not necessary as db names are not shards
and do not have the `.couch` extension any more.
---
src/couch/src/couch_flags.erl | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/couch/src/couch_flags.erl b/src/couch/src/couch_flags.erl
index 5cfe7f6..5bd133e 100644
--- a/src/couch/src/couch_flags.erl
+++ b/src/couch/src/couch_flags.erl
@@ -61,14 +61,10 @@
]).
-include_lib("couch/include/couch_db.hrl").
--include_lib("mem3/include/mem3.hrl").
--include("couch_db_int.hrl").
-type subject()
- :: #db{}
+ :: map()
| #httpd{}
- | #shard{}
- | #ordered_shard{}
| string()
| binary().
@@ -80,7 +76,7 @@ enabled(Subject) ->
Key = maybe_handle(subject_key, [Subject], fun subject_key/1),
Handle = couch_epi:get_handle({flags, config}),
lists:usort(enabled(Handle, {<<"/", Key/binary>>})
- ++ enabled(Handle, {couch_db:normalize_dbname(Key)})).
+ ++ enabled(Handle, {Key})).
-spec is_enabled(FlagId :: atom(), subject()) -> boolean().
@@ -104,16 +100,12 @@ enabled(Handle, Key) ->
-spec subject_key(subject()) -> binary().
-subject_key(#db{name = Name}) ->
- subject_key(Name);
+subject_key(#{} = Db) ->
+ subject_key(fabric2_db:name(Db));
subject_key(#httpd{path_parts=[Name | _Rest]}) ->
subject_key(Name);
subject_key(#httpd{path_parts=[]}) ->
<<>>;
-subject_key(#shard{name = Name}) ->
- subject_key(Name);
-subject_key(#ordered_shard{name = Name}) ->
- subject_key(Name);
subject_key(Name) when is_list(Name) ->
subject_key(list_to_binary(Name));
subject_key(Name) when is_binary(Name) ->