summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_amqqueue.erl7
-rw-r--r--src/rabbit_exchange.erl23
2 files changed, 19 insertions, 11 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index 50f804bc14..ce048726ac 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -22,7 +22,7 @@
forget_all_durable/1, delete_crashed/1, delete_crashed/2,
delete_crashed_internal/2]).
-export([pseudo_queue/2, pseudo_queue/3, immutable/1]).
--export([lookup/1, not_found_or_absent/1, with/2, with/3, with_or_die/2,
+-export([lookup/1, lookup_many/1, not_found_or_absent/1, with/2, with/3, with_or_die/2,
assert_equivalence/5,
check_exclusive_access/2, with_exclusive_access_or_die/3,
stat/1, deliver/2, deliver/3, requeue/4, ack/4, reject/5]).
@@ -488,6 +488,11 @@ lookup(Names) when is_list(Names) ->
lookup(Name) ->
rabbit_misc:dirty_read({rabbit_queue, Name}).
+-spec lookup_many ([name()]) -> [amqqueue:amqqueue()].
+
+lookup_many(Names) when is_list(Names) ->
+ lookup(Names).
+
-spec not_found_or_absent(name()) -> not_found_or_absent().
not_found_or_absent(Name) ->
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index d5b96adff1..df0138d165 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -20,7 +20,7 @@
-export([recover/1, policy_changed/2, callback/4, declare/7,
assert_equivalence/6, assert_args_equivalence/2, check_type/1,
- lookup/1, lookup_or_die/1, list/0, list/1, lookup_scratch/2,
+ lookup/1, lookup_many/1, lookup_or_die/1, list/0, list/1, lookup_scratch/2,
update_scratch/3, update_decorators/1, immutable/1,
info_keys/0, info/1, info/2, info_all/1, info_all/2, info_all/4,
route/2, delete/3, validate_binding/2, count/0]).
@@ -219,19 +219,22 @@ assert_args_equivalence(#exchange{ name = Name, arguments = Args },
-spec lookup
(name()) -> rabbit_types:ok(rabbit_types:exchange()) |
- rabbit_types:error('not_found');
- ([name()]) ->
- [rabbit_types:exchange()].
+ rabbit_types:error('not_found').
-lookup([]) -> [];
-lookup([Name]) -> ets:lookup(rabbit_exchange, Name);
-lookup(Names) when is_list(Names) ->
- %% Normally we'd call mnesia:dirty_read/1 here, but that is quite
- %% expensive for reasons explained in rabbit_misc:dirty_read/1.
- lists:append([ets:lookup(rabbit_exchange, Name) || Name <- Names]);
lookup(Name) ->
rabbit_misc:dirty_read({rabbit_exchange, Name}).
+
+-spec lookup_many([name()]) -> [rabbit_types:exchange()].
+
+lookup_many([]) -> [];
+lookup_many([Name]) -> ets:lookup(rabbit_exchange, Name);
+lookup_many(Names) when is_list(Names) ->
+ %% Normally we'd call mnesia:dirty_read/1 here, but that is quite
+ %% expensive for reasons explained in rabbit_misc:dirty_read/1.
+ lists:append([ets:lookup(rabbit_exchange, Name) || Name <- Names]).
+
+
-spec lookup_or_die
(name()) -> rabbit_types:exchange() |
rabbit_types:channel_exit().