diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2010-09-04 07:30:33 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-09-04 07:30:33 +0100 |
commit | c583ea0b0ce195bb73791bd7fccbdf6506926939 (patch) | |
tree | d8eda73f93e6654278476a97856343412221bcb3 /src/rabbit_binding.erl | |
parent | 83d8e5b2545959be3bd29b21d95340616dbe85e4 (diff) | |
download | rabbitmq-server-c583ea0b0ce195bb73791bd7fccbdf6506926939.tar.gz |
add a couple of convenience functions
so that callers can add/remove bindings without supplying a closure,
which can be tricky across an rpc call.
Diffstat (limited to 'src/rabbit_binding.erl')
-rw-r--r-- | src/rabbit_binding.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index a815f544..6caf7302 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -32,7 +32,7 @@ -module(rabbit_binding). -include("rabbit.hrl"). --export([recover/0, add/2, remove/2, list/1]). +-export([recover/0, add/1, remove/1, add/2, remove/2, list/1]). -export([list_for_exchange/1, list_for_queue/1, list_for_exchange_and_queue/2]). -export([info_keys/0, info/1, info/2, info_all/1, info_all/2]). %% these must all be run inside a mnesia tx @@ -56,6 +56,9 @@ -type(bindings() :: [rabbit_types:binding()]). -spec(recover/0 :: () -> [rabbit_types:binding()]). +-spec(add/1 :: (rabbit_types:binding()) -> bind_res()). +-spec(remove/1 :: (rabbit_types:binding()) -> + bind_res() | rabbit_types:error('binding_not_found')). -spec(add/2 :: (rabbit_types:binding(), inner_fun()) -> bind_res()). -spec(remove/2 :: (rabbit_types:binding(), inner_fun()) -> bind_res() | rabbit_types:error('binding_not_found')). @@ -93,6 +96,10 @@ recover() -> [B | Acc] end, [], rabbit_durable_route). +add(Binding) -> add(Binding, fun (_X, _Q) -> ok end). + +remove(Binding) -> remove(Binding, fun (_X, _Q) -> ok end). + add(Binding, InnerFun) -> case binding_action( Binding, |