Removed a lot of commented out code
This commit is contained in:
parent
1c0b11e81f
commit
708434f160
|
|
@ -172,42 +172,16 @@ add_default_binding(#amqqueue{name = QueueName}) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
add_binding(QueueName, ExchangeName, RoutingKey, Arguments) ->
|
add_binding(QueueName, ExchangeName, RoutingKey, Arguments) ->
|
||||||
% Since this calls straight through to rabbit_exchange,
|
|
||||||
% can this exported function be deleted from this module?
|
|
||||||
Binding = #binding{exchange_name = ExchangeName,
|
Binding = #binding{exchange_name = ExchangeName,
|
||||||
key = RoutingKey,
|
key = RoutingKey,
|
||||||
queue_name = QueueName},
|
queue_name = QueueName},
|
||||||
rabbit_misc:execute_mnesia_transaction(fun rabbit_exchange:add_binding/1, [Binding]).
|
rabbit_misc:execute_mnesia_transaction(fun rabbit_exchange:add_binding/1, [Binding]).
|
||||||
% modify_bindings(
|
|
||||||
% QueueName, ExchangeName, RoutingKey, Arguments,
|
|
||||||
% fun (Q, _Spec) -> {ok, Q} end,
|
|
||||||
% fun (Q, Spec) -> update_bindings(
|
|
||||||
% Q, Spec,
|
|
||||||
% fun (S, Specs) -> [S | Specs] end,
|
|
||||||
% fun rabbit_exchange:add_binding/2)
|
|
||||||
% end).
|
|
||||||
|
|
||||||
delete_binding(QueueName, ExchangeName, RoutingKey, Arguments) ->
|
delete_binding(QueueName, ExchangeName, RoutingKey, Arguments) ->
|
||||||
Binding = #binding{exchange_name = ExchangeName,
|
Binding = #binding{exchange_name = ExchangeName,
|
||||||
key = RoutingKey,
|
key = RoutingKey,
|
||||||
queue_name = QueueName},
|
queue_name = QueueName},
|
||||||
rabbit_misc:execute_mnesia_transaction(fun rabbit_exchange:delete_binding/1, [Binding]).
|
rabbit_misc:execute_mnesia_transaction(fun rabbit_exchange:delete_binding/1, [Binding]).
|
||||||
% modify_bindings(
|
|
||||||
% QueueName, ExchangeName, RoutingKey, Arguments,
|
|
||||||
% fun (Q, Spec) -> update_bindings(
|
|
||||||
% Q, Spec,
|
|
||||||
% fun lists:delete/2,
|
|
||||||
% fun rabbit_exchange:delete_binding/2)
|
|
||||||
% end,
|
|
||||||
% fun (Q, Spec) ->
|
|
||||||
% %% the following is essentially a no-op, though crucially
|
|
||||||
% %% it produces {error, not_found} when the exchange does
|
|
||||||
% %% not exist.
|
|
||||||
% case rabbit_exchange:delete_binding(Spec, Q) of
|
|
||||||
% ok -> {error, binding_not_found};
|
|
||||||
% Other -> Other
|
|
||||||
% end
|
|
||||||
% end).
|
|
||||||
|
|
||||||
lookup(Name) ->
|
lookup(Name) ->
|
||||||
rabbit_misc:dirty_read({amqqueue, Name}).
|
rabbit_misc:dirty_read({amqqueue, Name}).
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ simple_publish(Mandatory, Immediate,
|
||||||
route(#exchange{name = Name, type = topic}, RoutingKey) ->
|
route(#exchange{name = Name, type = topic}, RoutingKey) ->
|
||||||
route_internal(Name, RoutingKey, fun topic_matches/2);
|
route_internal(Name, RoutingKey, fun topic_matches/2);
|
||||||
|
|
||||||
route(#exchange{name = Name, type = Type}, RoutingKey) ->
|
route(#exchange{name = Name}, RoutingKey) ->
|
||||||
route_internal(Name, RoutingKey).
|
route_internal(Name, RoutingKey).
|
||||||
|
|
||||||
% This returns a list of QPids to route to.
|
% This returns a list of QPids to route to.
|
||||||
|
|
@ -191,16 +191,9 @@ route_internal(#resource{name = Name, virtual_host = VHostPath}, RoutingKey) ->
|
||||||
queue_name = '$3',
|
queue_name = '$3',
|
||||||
key = '$4'}},
|
key = '$4'}},
|
||||||
Guards = [{'==', '$1', Name}, {'==', '$2', VHostPath}, {'==', '$4', RoutingKey}],
|
Guards = [{'==', '$1', Name}, {'==', '$2', VHostPath}, {'==', '$4', RoutingKey}],
|
||||||
|
lookup_qpids(mnesia:activity(async_dirty,
|
||||||
{Time, X} = timer:tc(mnesia,activity,[async_dirty,
|
|
||||||
fun() -> mnesia:select(route,[{MatchHead, Guards, ['$3']}])
|
fun() -> mnesia:select(route,[{MatchHead, Guards, ['$3']}])
|
||||||
end]),
|
end)).
|
||||||
%io:format("First read = ~p~n",[Time]),
|
|
||||||
lookup_qpids(X).
|
|
||||||
% lookup_qpids(
|
|
||||||
% mnesia:activity(async_dirty,
|
|
||||||
% fun() -> mnesia:select(route,[{MatchHead, Guards, ['$3']}])
|
|
||||||
% end)).
|
|
||||||
|
|
||||||
% This returns a list of QPids to route to.
|
% This returns a list of QPids to route to.
|
||||||
% Maybe this should be handled by a cursor instead.
|
% Maybe this should be handled by a cursor instead.
|
||||||
|
|
@ -220,24 +213,16 @@ lookup_qpids(Queues) ->
|
||||||
fun(Key, Acc) -> [#amqqueue{pid = QPid}] = mnesia:read({amqqueue, Key}),
|
fun(Key, Acc) -> [#amqqueue{pid = QPid}] = mnesia:read({amqqueue, Key}),
|
||||||
[QPid] ++ Acc end,
|
[QPid] ++ Acc end,
|
||||||
[], Set) end,
|
[], Set) end,
|
||||||
%mnesia:activity(async_dirty,Fun).
|
mnesia:activity(async_dirty,Fun).
|
||||||
{Time, X} = timer:tc(mnesia,activity,[async_dirty,Fun]),
|
|
||||||
%io:format("Second read = ~p~n",[Time]),
|
|
||||||
X.
|
|
||||||
|
|
||||||
% Should all of the route and binding management not be refactored to it's own module
|
% Should all of the route and binding management not be refactored to it's own module
|
||||||
% Especially seeing as unbind will have to be implemented for 0.91 ?
|
% Especially seeing as unbind will have to be implemented for 0.91 ?
|
||||||
delete_routes(Q = #amqqueue{name = Name}) ->
|
delete_routes(#amqqueue{name = Name}) ->
|
||||||
Binding = #binding{queue_name = Name, exchange_name = '_', key = '_'},
|
Binding = #binding{queue_name = Name, exchange_name = '_', key = '_'},
|
||||||
{Route, ReverseRoute} = route_with_reverse(Binding),
|
{Route, ReverseRoute} = route_with_reverse(Binding),
|
||||||
ok = mnesia:delete_object(Route),
|
ok = mnesia:delete_object(Route),
|
||||||
ok = mnesia:delete_object(ReverseRoute).
|
ok = mnesia:delete_object(ReverseRoute).
|
||||||
|
|
||||||
delivery_key_for_type(fanout, Name, _RoutingKey) ->
|
|
||||||
{Name, fanout};
|
|
||||||
delivery_key_for_type(_Type, Name, RoutingKey) ->
|
|
||||||
{Name, RoutingKey}.
|
|
||||||
|
|
||||||
% Don't really like this double lookup
|
% Don't really like this double lookup
|
||||||
% It seems very clunky
|
% It seems very clunky
|
||||||
% Can this get refactored to to avoid the duplication of the lookup/1 function?
|
% Can this get refactored to to avoid the duplication of the lookup/1 function?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue