|
20 | 20 |
|
21 | 21 | -export([recover/1, policy_changed/2, callback/4, declare/7, |
22 | 22 | assert_equivalence/6, assert_args_equivalence/2, check_type/1, |
23 | | - lookup/1, lookup_or_die/1, list/0, list/1, lookup_scratch/2, |
| 23 | + lookup/1, lookup_many/1, lookup_or_die/1, list/0, list/1, lookup_scratch/2, |
24 | 24 | update_scratch/3, update_decorators/1, immutable/1, |
25 | 25 | info_keys/0, info/1, info/2, info_all/1, info_all/2, info_all/4, |
26 | 26 | route/2, delete/3, validate_binding/2]). |
|
55 | 55 | -spec assert_args_equivalence |
56 | 56 | (rabbit_types:exchange(), rabbit_framing:amqp_table()) |
57 | 57 | -> 'ok' | rabbit_types:connection_exit(). |
58 | | --spec lookup_or_die |
59 | | - (name()) -> rabbit_types:exchange() | |
60 | | - rabbit_types:channel_exit(). |
61 | 58 | -spec list() -> [rabbit_types:exchange()]. |
62 | 59 | -spec list_names() -> [rabbit_exchange:name()]. |
63 | 60 | -spec list(rabbit_types:vhost()) -> [rabbit_types:exchange()]. |
@@ -252,19 +249,26 @@ assert_args_equivalence(#exchange{ name = Name, arguments = Args }, |
252 | 249 |
|
253 | 250 | -spec lookup |
254 | 251 | (name()) -> rabbit_types:ok(rabbit_types:exchange()) | |
255 | | - rabbit_types:error('not_found'); |
256 | | - ([name()]) -> |
257 | | - [rabbit_types:exchange()]. |
| 252 | + rabbit_types:error('not_found'). |
258 | 253 |
|
259 | | -lookup([]) -> []; |
260 | | -lookup([Name]) -> ets:lookup(rabbit_exchange, Name); |
261 | | -lookup(Names) when is_list(Names) -> |
262 | | - %% Normally we'd call mnesia:dirty_read/1 here, but that is quite |
263 | | - %% expensive for reasons explained in rabbit_misc:dirty_read/1. |
264 | | - lists:append([ets:lookup(rabbit_exchange, Name) || Name <- Names]); |
265 | 254 | lookup(Name) -> |
266 | 255 | rabbit_misc:dirty_read({rabbit_exchange, Name}). |
267 | 256 |
|
| 257 | + |
| 258 | +-spec lookup_many([name()]) -> [rabbit_types:exchange()]. |
| 259 | + |
| 260 | +lookup_many([]) -> []; |
| 261 | +lookup_many([Name]) -> ets:lookup(rabbit_exchange, Name); |
| 262 | +lookup_many(Names) when is_list(Names) -> |
| 263 | + %% Normally we'd call mnesia:dirty_read/1 here, but that is quite |
| 264 | + %% expensive for reasons explained in rabbit_misc:dirty_read/1. |
| 265 | + lists:append([ets:lookup(rabbit_exchange, Name) || Name <- Names]). |
| 266 | + |
| 267 | + |
| 268 | +-spec lookup_or_die |
| 269 | + (name()) -> rabbit_types:exchange() | |
| 270 | + rabbit_types:channel_exit(). |
| 271 | + |
268 | 272 | lookup_or_die(Name) -> |
269 | 273 | case lookup(Name) of |
270 | 274 | {ok, X} -> X; |
|
0 commit comments