summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-02-26 18:04:45 +0000
committerSimon MacMullen <simon@rabbitmq.com>2013-02-26 18:04:45 +0000
commitfca69ebecd5f17e5857225a1bab6434e8b391161 (patch)
treee787a5abcde77f0682024daa797555d849ea5271
parentcec7b07abb68a6a44ffb84f7c3c25096609d1db7 (diff)
downloadrabbitmq-server-bug25432.tar.gz
Remove concept of strictness, thus renaming list_strict/1 to list_component/1 and removing list_strict/2 altogether, plus a few bits of therefore dead code.bug25432
-rw-r--r--src/rabbit_runtime_parameters.erl36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl
index b1100b65..05520170 100644
--- a/src/rabbit_runtime_parameters.erl
+++ b/src/rabbit_runtime_parameters.erl
@@ -19,7 +19,7 @@
-include("rabbit.hrl").
-export([parse_set/4, set/4, set_any/4, clear/3, clear_any/3, list/0, list/1,
- list_strict/1, list/2, list_strict/2, list_formatted/1, lookup/3,
+ list_component/1, list/2, list_formatted/1, lookup/3,
value/3, value/4, info_keys/0]).
%%----------------------------------------------------------------------------
@@ -40,12 +40,9 @@
-> ok_or_error_string()).
-spec(list/0 :: () -> [rabbit_types:infos()]).
-spec(list/1 :: (rabbit_types:vhost() | '_') -> [rabbit_types:infos()]).
--spec(list_strict/1 :: (binary() | '_')
- -> [rabbit_types:infos()] | 'not_found').
+-spec(list_component/1 :: (binary()) -> [rabbit_types:infos()]).
-spec(list/2 :: (rabbit_types:vhost() | '_', binary() | '_')
-> [rabbit_types:infos()]).
--spec(list_strict/2 :: (rabbit_types:vhost() | '_', binary() | '_')
- -> [rabbit_types:infos()] | 'not_found').
-spec(list_formatted/1 :: (rabbit_types:vhost()) -> [rabbit_types:infos()]).
-spec(lookup/3 :: (rabbit_types:vhost(), binary(), binary())
-> rabbit_types:infos() | 'not_found').
@@ -139,21 +136,14 @@ list() ->
[p(P) || #runtime_parameters{ key = {_VHost, Comp, _Name}} = P <-
rabbit_misc:dirty_read_all(?TABLE), Comp /= <<"policy">>].
-list(VHost) -> list(VHost, '_', []).
-list_strict(Component) -> list('_', Component, not_found).
-list(VHost, Component) -> list(VHost, Component, []).
-list_strict(VHost, Component) -> list(VHost, Component, not_found).
-
-list(VHost, Component, Default) ->
- case component_good(Component) of
- true -> Match = #runtime_parameters{key = {VHost, Component, '_'},
- _ = '_'},
- [p(P) || #runtime_parameters{ key = {_VHost, Comp, _Name}} = P <-
- mnesia:dirty_match_object(?TABLE, Match),
- Comp =/= <<"policy">> orelse
- Component =:= <<"policy">>];
- _ -> Default
- end.
+list(VHost) -> list(VHost, '_').
+list_component(Component) -> list('_', Component).
+
+list(VHost, Component) ->
+ Match = #runtime_parameters{key = {VHost, Component, '_'}, _ = '_'},
+ [p(P) || #runtime_parameters{key = {_VHost, Comp, _Name}} = P <-
+ mnesia:dirty_match_object(?TABLE, Match),
+ Comp =/= <<"policy">> orelse Component =:= <<"policy">>].
list_formatted(VHost) ->
[pset(value, format(pget(value, P)), P) || P <- list(VHost)].
@@ -208,12 +198,6 @@ info_keys() -> [component, name, value].
%%---------------------------------------------------------------------------
-component_good('_') -> true;
-component_good(Component) -> case lookup_component(Component) of
- {ok, _} -> true;
- _ -> false
- end.
-
lookup_component(Component) ->
case rabbit_registry:lookup_module(
runtime_parameter, list_to_atom(binary_to_list(Component))) of