summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_amqqueue.erl4
-rw-r--r--src/rabbit_binding.erl66
-rw-r--r--src/rabbit_channel.erl2
-rw-r--r--src/rabbit_exchange.erl4
-rw-r--r--src/rabbit_exchange_type_headers.erl2
5 files changed, 39 insertions, 39 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index e9f13b5c..8a923780 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -433,7 +433,7 @@ internal_delete1(QueueName) ->
%% we want to execute some things, as
%% decided by rabbit_exchange, after the
%% transaction.
- rabbit_binding:delete_queue_bindings(QueueName).
+ rabbit_binding:remove_for_queue(QueueName).
internal_delete(QueueName) ->
case
@@ -478,7 +478,7 @@ on_node_down(Node) ->
ok.
delete_queue(QueueName) ->
- Post = rabbit_binding:delete_transient_queue_bindings(QueueName),
+ Post = rabbit_binding:remove_transient_for_queue(QueueName),
ok = mnesia:delete({rabbit_queue, QueueName}),
Post.
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl
index 15f3fa87..d5e19d31 100644
--- a/src/rabbit_binding.erl
+++ b/src/rabbit_binding.erl
@@ -32,11 +32,11 @@
-module(rabbit_binding).
-include("rabbit.hrl").
--export([recover/0, add/5, delete/5, list/1]).
--export([list_exchange_bindings/1, list_queue_bindings/1]).
+-export([recover/0, add/5, remove/5, list/1]).
+-export([list_for_exchange/1, list_for_queue/1]).
%% these must all be run inside a mnesia tx
--export([has_exchange_bindings/1, delete_exchange_bindings/1,
- delete_queue_bindings/1, delete_transient_queue_bindings/1]).
+-export([has_for_exchange/1, remove_for_exchange/1,
+ remove_for_queue/1, remove_transient_for_queue/1]).
%%----------------------------------------------------------------------------
@@ -58,7 +58,7 @@
(rabbit_exchange:name(), rabbit_amqqueue:name(),
rabbit_router:routing_key(), rabbit_framing:amqp_table(),
inner_fun()) -> bind_res()).
--spec(delete/5 ::
+-spec(remove/5 ::
(rabbit_exchange:name(), rabbit_amqqueue:name(),
rabbit_router:routing_key(), rabbit_framing:amqp_table(),
inner_fun()) -> bind_res() | rabbit_types:error('binding_not_found')).
@@ -66,20 +66,20 @@
[{rabbit_exchange:name(), rabbit_amqqueue:name(),
rabbit_router:routing_key(),
rabbit_framing:amqp_table()}]).
--spec(list_exchange_bindings/1 ::
+-spec(list_for_exchange/1 ::
(rabbit_exchange:name()) -> [{rabbit_amqqueue:name(),
rabbit_router:routing_key(),
rabbit_framing:amqp_table()}]).
--spec(list_queue_bindings/1 ::
+-spec(list_for_queue/1 ::
(rabbit_amqqueue:name()) -> [{rabbit_exchange:name(),
rabbit_router:routing_key(),
rabbit_framing:amqp_table()}]).
--spec(has_exchange_bindings/1 :: (rabbit_exchange:name()) -> boolean()).
--spec(delete_exchange_bindings/1 ::
+-spec(has_for_exchange/1 :: (rabbit_exchange:name()) -> boolean()).
+-spec(remove_for_exchange/1 ::
(rabbit_exchange:name()) -> [rabbit_types:binding()]).
--spec(delete_queue_bindings/1 ::
+-spec(remove_for_queue/1 ::
(rabbit_amqqueue:name()) -> fun (() -> any())).
--spec(delete_transient_queue_bindings/1 ::
+-spec(remove_transient_for_queue/1 ::
(rabbit_amqqueue:name()) -> fun (() -> any())).
-endif.
@@ -132,7 +132,7 @@ add(ExchangeName, QueueName, RoutingKey, Arguments, InnerFun) ->
Err
end.
-delete(ExchangeName, QueueName, RoutingKey, Arguments, InnerFun) ->
+remove(ExchangeName, QueueName, RoutingKey, Arguments, InnerFun) ->
case binding_action(
ExchangeName, QueueName, RoutingKey, Arguments,
fun (X, Q, B) ->
@@ -183,7 +183,7 @@ list(VHostPath) ->
_ = '_'},
_ = '_'})].
-list_exchange_bindings(ExchangeName) ->
+list_for_exchange(ExchangeName) ->
Route = #route{binding = #binding{exchange_name = ExchangeName, _ = '_'}},
[{QueueName, RoutingKey, Arguments} ||
#route{binding = #binding{queue_name = QueueName,
@@ -192,7 +192,7 @@ list_exchange_bindings(ExchangeName) ->
<- mnesia:dirty_match_object(rabbit_route, Route)].
% Refactoring is left as an exercise for the reader
-list_queue_bindings(QueueName) ->
+list_for_queue(QueueName) ->
Route = #route{binding = #binding{queue_name = QueueName, _ = '_'}},
[{ExchangeName, RoutingKey, Arguments} ||
#route{binding = #binding{exchange_name = ExchangeName,
@@ -200,14 +200,14 @@ list_queue_bindings(QueueName) ->
args = Arguments}}
<- mnesia:dirty_match_object(rabbit_route, Route)].
-has_exchange_bindings(ExchangeName) ->
+has_for_exchange(ExchangeName) ->
Match = #route{binding = #binding{exchange_name = ExchangeName, _ = '_'}},
%% we need to check for durable routes here too in case a bunch of
%% routes to durable queues have been removed temporarily as a
%% result of a node failure
contains(rabbit_route, Match) orelse contains(rabbit_durable_route, Match).
-delete_exchange_bindings(ExchangeName) ->
+remove_for_exchange(ExchangeName) ->
[begin
ok = mnesia:delete_object(rabbit_reverse_route,
reverse_route(Route), write),
@@ -219,11 +219,11 @@ delete_exchange_bindings(ExchangeName) ->
_ = '_'}},
write)].
-delete_queue_bindings(QueueName) ->
- delete_queue_bindings(QueueName, fun delete_forward_routes/1).
+remove_for_queue(QueueName) ->
+ remove_for_queue(QueueName, fun delete_forward_routes/1).
-delete_transient_queue_bindings(QueueName) ->
- delete_queue_bindings(QueueName, fun delete_transient_forward_routes/1).
+remove_transient_for_queue(QueueName) ->
+ remove_for_queue(QueueName, fun delete_transient_forward_routes/1).
%%----------------------------------------------------------------------------
@@ -272,7 +272,7 @@ continue('$end_of_table') -> false;
continue({[_|_], _}) -> true;
continue({[], Continuation}) -> continue(mnesia:select(Continuation)).
-delete_queue_bindings(QueueName, FwdDeleteFun) ->
+remove_for_queue(QueueName, FwdDeleteFun) ->
DeletedBindings =
[begin
Route = reverse_route(ReverseRoute),
@@ -287,7 +287,7 @@ delete_queue_bindings(QueueName, FwdDeleteFun) ->
queue_name = QueueName,
_ = '_'}}),
write)],
- Cleanup = cleanup_deleted_queue_bindings(
+ Cleanup = cleanup_removed_queue_bindings(
lists:keysort(#binding.exchange_name, DeletedBindings), []),
fun () ->
lists:foreach(
@@ -302,23 +302,23 @@ delete_queue_bindings(QueueName, FwdDeleteFun) ->
%% Requires that its input binding list is sorted in exchange-name
%% order, so that the grouping of bindings (for passing to
-%% cleanup_deleted_queue_bindings1) works properly.
-cleanup_deleted_queue_bindings([], Acc) ->
+%% cleanup_removed_queue_bindings1) works properly.
+cleanup_removed_queue_bindings([], Acc) ->
Acc;
-cleanup_deleted_queue_bindings(
+cleanup_removed_queue_bindings(
[B = #binding{exchange_name = ExchangeName} | Bs], Acc) ->
- cleanup_deleted_queue_bindings(ExchangeName, Bs, [B], Acc).
+ cleanup_removed_queue_bindings(ExchangeName, Bs, [B], Acc).
-cleanup_deleted_queue_bindings(
+cleanup_removed_queue_bindings(
ExchangeName, [B = #binding{exchange_name = ExchangeName} | Bs],
Bindings, Acc) ->
- cleanup_deleted_queue_bindings(ExchangeName, Bs, [B | Bindings], Acc);
-cleanup_deleted_queue_bindings(ExchangeName, Deleted, Bindings, Acc) ->
- %% either Deleted is [], or its head has a non-matching ExchangeName
- NewAcc = [cleanup_deleted_queue_bindings1(ExchangeName, Bindings) | Acc],
- cleanup_deleted_queue_bindings(Deleted, NewAcc).
+ cleanup_removed_queue_bindings(ExchangeName, Bs, [B | Bindings], Acc);
+cleanup_removed_queue_bindings(ExchangeName, Removed, Bindings, Acc) ->
+ %% either Removed is [], or its head has a non-matching ExchangeName
+ NewAcc = [cleanup_removed_queue_bindings1(ExchangeName, Bindings) | Acc],
+ cleanup_removed_queue_bindings(Removed, NewAcc).
-cleanup_deleted_queue_bindings1(ExchangeName, Bindings) ->
+cleanup_removed_queue_bindings1(ExchangeName, Bindings) ->
[X] = mnesia:read({rabbit_exchange, ExchangeName}),
{{rabbit_exchange:maybe_auto_delete(X), X}, Bindings}.
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 097e36c6..8e5735c5 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -815,7 +815,7 @@ handle_method(#'queue.unbind'{queue = QueueNameBin,
exchange = ExchangeNameBin,
routing_key = RoutingKey,
arguments = Arguments}, _, State) ->
- binding_action(fun rabbit_binding:delete/5,
+ binding_action(fun rabbit_binding:remove/5,
ExchangeNameBin, QueueNameBin, RoutingKey, Arguments,
#'queue.unbind_ok'{}, false, State);
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index d98cb20d..68290aa1 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -289,13 +289,13 @@ maybe_auto_delete(#exchange{auto_delete = true} = Exchange) ->
end.
conditional_delete(Exchange = #exchange{name = ExchangeName}) ->
- case rabbit_binding:has_exchange_bindings(ExchangeName) of
+ case rabbit_binding:has_for_exchange(ExchangeName) of
false -> unconditional_delete(Exchange);
true -> {error, in_use}
end.
unconditional_delete(Exchange = #exchange{name = ExchangeName}) ->
- Bindings = rabbit_binding:delete_exchange_bindings(ExchangeName),
+ Bindings = rabbit_binding:remove_for_exchange(ExchangeName),
ok = mnesia:delete({rabbit_durable_exchange, ExchangeName}),
ok = mnesia:delete({rabbit_exchange, ExchangeName}),
rabbit_event:notify(exchange_deleted, [{name, ExchangeName}]),
diff --git a/src/rabbit_exchange_type_headers.erl b/src/rabbit_exchange_type_headers.erl
index c4b256b8..02e829ec 100644
--- a/src/rabbit_exchange_type_headers.erl
+++ b/src/rabbit_exchange_type_headers.erl
@@ -80,7 +80,7 @@ parse_x_match(Other) ->
%% Horrendous matching algorithm. Depends for its merge-like
%% (linear-time) behaviour on the lists:keysort
%% (rabbit_misc:sort_field_table) that publish/1 and
-%% rabbit_binding:{add,delete}/5 do.
+%% rabbit_binding:{add,remove}/5 do.
%%
%% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
%% In other words: REQUIRES BOTH PATTERN AND DATA TO BE SORTED ASCENDING BY KEY.