diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-10-28 17:08:55 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-10-28 17:08:55 +0000 |
commit | 2a004a1006a960411f203cc3280592ef4a227bc0 (patch) | |
tree | 673ef2a8acd1b0113f96920b34c82528aa5e2c93 /src/rabbit_runtime_parameters.erl | |
parent | 3777b5c641be257d62d9a4c1a7736bb6aed1c436 (diff) | |
download | rabbitmq-server-2a004a1006a960411f203cc3280592ef4a227bc0.tar.gz |
Use mnesia:async_dirty/1 to reduce copypasta.
Diffstat (limited to 'src/rabbit_runtime_parameters.erl')
-rw-r--r-- | src/rabbit_runtime_parameters.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl index c13c333e..4e4be6bc 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_component/1, list/2, list_formatted/1, lookup/3, + list_component/1, list/2, list_tx/2, list_formatted/1, lookup/3, value/3, value/4, info_keys/0]). %%---------------------------------------------------------------------------- @@ -43,6 +43,8 @@ -spec(list_component/1 :: (binary()) -> [rabbit_types:infos()]). -spec(list/2 :: (rabbit_types:vhost() | '_', binary() | '_') -> [rabbit_types:infos()]). +-spec(list_tx/2 :: (rabbit_types:vhost() | '_', binary() | '_') + -> [rabbit_types:infos()]). -spec(list_formatted/1 :: (rabbit_types:vhost()) -> [rabbit_types:infos()]). -spec(lookup/3 :: (rabbit_types:vhost(), binary(), binary()) -> rabbit_types:infos() | 'not_found'). @@ -140,13 +142,16 @@ list(VHost) -> list(VHost, '_'). list_component(Component) -> list('_', Component). list(VHost, Component) -> + mnesia:async_dirty(fun () -> list_tx(VHost, Component) end). + +list_tx(VHost, Component) -> case VHost of '_' -> ok; _ -> rabbit_vhost:assert(VHost) end, Match = #runtime_parameters{key = {VHost, Component, '_'}, _ = '_'}, [p(P) || #runtime_parameters{key = {_VHost, Comp, _Name}} = P <- - mnesia:dirty_match_object(?TABLE, Match), + mnesia:match_object(?TABLE, Match, read), Comp =/= <<"policy">> orelse Component =:= <<"policy">>]. list_formatted(VHost) -> |