diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2011-05-23 15:06:10 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2011-05-23 15:06:10 +0100 |
commit | 26097dd85c3bf96fc6ddf8f5d7f79b8e42571984 (patch) | |
tree | d2dd581fdd5104f22a78828a4cae42c0e6a23c9c /src/rabbit_vhost.erl | |
parent | f6faad9903a5e9b612345bd3f790c998af75e188 (diff) | |
download | rabbitmq-server-26097dd85c3bf96fc6ddf8f5d7f79b8e42571984.tar.gz |
Add a "tracing" column to the list_vhosts command. A bigger change than expected, as vhosts didn't have the standard info item infrastructure.bug24129
Diffstat (limited to 'src/rabbit_vhost.erl')
-rw-r--r-- | src/rabbit_vhost.erl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl index 67c73cf2..5270d80b 100644 --- a/src/rabbit_vhost.erl +++ b/src/rabbit_vhost.erl @@ -21,6 +21,7 @@ %%---------------------------------------------------------------------------- -export([add/1, delete/1, exists/1, list/0, with/2]). +-export([info/1, info/2, info_all/0, info_all/1]). -ifdef(use_specs). @@ -30,10 +31,18 @@ -spec(list/0 :: () -> [rabbit_types:vhost()]). -spec(with/2 :: (rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A). +-spec(info/1 :: (rabbit_types:vhost()) -> rabbit_types:infos()). +-spec(info/2 :: (rabbit_types:vhost(), rabbit_types:info_keys()) + -> rabbit_types:infos()). +-spec(info_all/0 :: () -> [rabbit_types:infos()]). +-spec(info_all/1 :: (rabbit_types:info_keys()) -> [rabbit_types:infos()]). + -endif. %%---------------------------------------------------------------------------- +-define(INFO_KEYS, [name, tracing]). + add(VHostPath) -> R = rabbit_misc:execute_mnesia_transaction( fun () -> @@ -105,3 +114,17 @@ with(VHostPath, Thunk) -> Thunk() end end. + +%%---------------------------------------------------------------------------- + +infos(Items, X) -> [{Item, i(Item, X)} || Item <- Items]. + +i(name, VHost) -> VHost; +i(tracing, VHost) -> rabbit_trace:tracing(VHost); +i(Item, _) -> throw({bad_argument, Item}). + +info(VHost) -> infos(?INFO_KEYS, VHost). +info(VHost, Items) -> infos(Items, VHost). + +info_all() -> info_all(?INFO_KEYS). +info_all(Items) -> [info(VHost, Items) || VHost <- list()]. |