diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2012-06-07 15:55:44 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2012-06-07 15:55:44 +0100 |
| commit | 359d21f94162d451e79f3430be220983652f7922 (patch) | |
| tree | e47688bd06fb9ec82b08979e92a2350419f07604 /src | |
| parent | 6b7c8cb20e31101158667f5040bb7af8bb902367 (diff) | |
| download | rabbitmq-server-git-359d21f94162d451e79f3430be220983652f7922.tar.gz | |
Strict and non-strict list by component.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_runtime_parameters.erl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl index 172cee92db..3a54e8f621 100644 --- a/src/rabbit_runtime_parameters.erl +++ b/src/rabbit_runtime_parameters.erl @@ -18,8 +18,8 @@ -include("rabbit.hrl"). --export([parse_set/3, set/3, clear/2, list/0, list/1, list_formatted/0, - lookup/2, value/2, value/3, info_keys/0]). +-export([parse_set/3, set/3, clear/2, list/0, list/1, list_strict/1, + list_formatted/0, lookup/2, value/2, value/3, info_keys/0]). %%---------------------------------------------------------------------------- @@ -31,7 +31,8 @@ -spec(set/3 :: (binary(), binary(), term()) -> ok_or_error_string()). -spec(clear/2 :: (binary(), binary()) -> ok_or_error_string()). -spec(list/0 :: () -> [rabbit_types:infos()]). --spec(list/1 :: (binary()) -> [rabbit_types:infos()] | 'not_found'). +-spec(list/1 :: (binary()) -> [rabbit_types:infos()]). +-spec(list_strict/1 :: (binary()) -> [rabbit_types:infos()] | 'not_found'). -spec(list_formatted/0 :: () -> [rabbit_types:infos()]). -spec(lookup/2 :: (binary(), binary()) -> rabbit_types:infos()). -spec(value/2 :: (binary(), binary()) -> term()). @@ -122,11 +123,14 @@ mnesia_clear(Component, Key) -> list() -> [p(P) || P <- rabbit_misc:dirty_read_all(?TABLE)]. -list(Component) -> +list(Component) -> list(Component, []). +list_strict(Component) -> list(Component, not_found). + +list(Component, Default) -> case lookup_component(Component) of {ok, _} -> Match = #runtime_parameters{key = {Component, '_'}, _ = '_'}, [p(P) || P <- mnesia:dirty_match_object(?TABLE, Match)]; - _ -> not_found + _ -> Default end. list_formatted() -> |
