Skip to content

Commit 2d28353

Browse files
authored
Merge pull request #15693 from rabbitmq/cleanups-after-mnesia-code-removal
Binding code cleanup after Mnesia code removal
2 parents 7f63cc3 + b9e89fa commit 2d28353

4 files changed

Lines changed: 23 additions & 100 deletions

File tree

deps/rabbit/include/rabbit_khepri.hrl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656
?RABBITMQ_KHEPRI_EXCHANGE_PATH(
5757
VHost, Exchange, [user_permissions, Username])).
5858

59-
-define(RABBITMQ_KHEPRI_ROUTE_PATH(VHost, SrcName, Kind, DstName, RoutingKey),
59+
-define(RABBITMQ_KHEPRI_ROUTE_PATH(VHost, SrcName, Kind, DstName, BindingKey),
6060
?RABBITMQ_KHEPRI_EXCHANGE_PATH(
61-
VHost, SrcName, [bindings, Kind, DstName, RoutingKey])).
61+
VHost, SrcName, [bindings, Kind, DstName, BindingKey])).
6262

6363
-define(RABBITMQ_KHEPRI_QUEUE_PATH(VHost, Name),
6464
?RABBITMQ_KHEPRI_VHOST_PATH(VHost, [queues, Name])).

deps/rabbit/src/rabbit_db_binding.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,11 @@ khepri_route_path(
635635
key = RoutingKey}) ->
636636
khepri_route_path(VHost, SrcName, Kind, DstName, RoutingKey).
637637

638-
khepri_route_path(VHost, SrcName, Kind, DstName, RoutingKey)
638+
khepri_route_path(VHost, SrcName, Kind, DstName, BindingKey)
639639
when ?IS_KHEPRI_PATH_CONDITION(Kind) andalso
640640
?IS_KHEPRI_PATH_CONDITION(DstName) andalso
641-
?IS_KHEPRI_PATH_CONDITION(RoutingKey) ->
642-
?RABBITMQ_KHEPRI_ROUTE_PATH(VHost, SrcName, Kind, DstName, RoutingKey).
641+
?IS_KHEPRI_PATH_CONDITION(BindingKey) ->
642+
?RABBITMQ_KHEPRI_ROUTE_PATH(VHost, SrcName, Kind, DstName, BindingKey).
643643

644644
khepri_route_path_to_args(Path) ->
645645
Pattern = khepri_route_path(

deps/rabbit/src/rabbit_db_topic_exchange.erl

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@
99

1010
-include_lib("rabbit_common/include/rabbit.hrl").
1111

12-
-export([set/1, delete_all_for_exchange/1, delete/1, match/3]).
12+
-export([match/3]).
1313

1414
%% Used by Khepri projections and the Mnesia-to-Khepri migration.
15-
-export([
16-
split_topic_key/1,
17-
split_topic_key_binary/1
18-
]).
19-
20-
%% For testing
21-
-export([clear/0]).
15+
-export([split_topic_key_binary/1]).
2216

2317
-define(KHEPRI_PROJECTION, rabbit_khepri_topic_trie_v3).
2418

@@ -27,49 +21,6 @@
2721

2822
-define(COMPILED_TOPIC_SPLIT_PATTERN, cp_dot).
2923

30-
%% -------------------------------------------------------------------
31-
%% set().
32-
%% -------------------------------------------------------------------
33-
34-
-spec set(Binding) -> ok when
35-
Binding :: rabbit_types:binding().
36-
%% @doc Sets a topic binding.
37-
%%
38-
%% @private
39-
40-
set(#binding{}) ->
41-
ok.
42-
43-
%% -------------------------------------------------------------------
44-
%% delete_all_for_exchange().
45-
%% -------------------------------------------------------------------
46-
47-
-spec delete_all_for_exchange(ExchangeName) -> ok when
48-
ExchangeName :: rabbit_exchange:name().
49-
%% @doc Deletes all topic bindings for the exchange named `ExchangeName'
50-
%%
51-
%% @private
52-
53-
delete_all_for_exchange(_XName) ->
54-
ok.
55-
56-
%% -------------------------------------------------------------------
57-
%% delete().
58-
%% -------------------------------------------------------------------
59-
60-
-spec delete([Binding]) -> ok when
61-
Binding :: rabbit_types:binding().
62-
%% @doc Deletes all given topic bindings
63-
%%
64-
%% @private
65-
66-
delete(Bs) when is_list(Bs) ->
67-
ok.
68-
69-
%% -------------------------------------------------------------------
70-
%% match().
71-
%% -------------------------------------------------------------------
72-
7324
-spec match(rabbit_exchange:name(),
7425
rabbit_types:routing_key(),
7526
rabbit_exchange:route_opts()) -> match_result().
@@ -85,38 +36,6 @@ match(XName, RoutingKey, Opts) ->
8536
Words = split_topic_key_binary(RoutingKey),
8637
trie_match_in_khepri(XName, Words, BKeys).
8738

88-
%% -------------------------------------------------------------------
89-
%% clear().
90-
%% -------------------------------------------------------------------
91-
92-
-spec clear() -> ok.
93-
%% @doc Deletes all topic bindings
94-
%%
95-
%% @private
96-
97-
clear() ->
98-
ok.
99-
100-
%% --------------------------------------------------------------
101-
%% split_topic_key().
102-
%% --------------------------------------------------------------
103-
104-
-spec split_topic_key(RoutingKey) -> Words when
105-
RoutingKey :: binary(),
106-
Words :: [[byte()]].
107-
108-
split_topic_key(Key) ->
109-
split_topic_key(Key, [], []).
110-
111-
split_topic_key(<<>>, [], []) ->
112-
[];
113-
split_topic_key(<<>>, RevWordAcc, RevResAcc) ->
114-
lists:reverse([lists:reverse(RevWordAcc) | RevResAcc]);
115-
split_topic_key(<<$., Rest/binary>>, RevWordAcc, RevResAcc) ->
116-
split_topic_key(Rest, [], [lists:reverse(RevWordAcc) | RevResAcc]);
117-
split_topic_key(<<C:8, Rest/binary>>, RevWordAcc, RevResAcc) ->
118-
split_topic_key(Rest, [C | RevWordAcc], RevResAcc).
119-
12039
%% --------------------------------------------------------------
12140
%% split_topic_key_binary().
12241
%% --------------------------------------------------------------

deps/rabbit/src/rabbit_exchange_type_topic.erl

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,26 @@ route(#exchange{name = XName}, Msg, Opts) ->
4343
RKeys = mc:routing_keys(Msg),
4444
lists:append([rabbit_db_topic_exchange:match(XName, RKey, Opts) || RKey <- RKeys]).
4545

46-
validate(_X) -> ok.
47-
validate_binding(_X, _B) -> ok.
48-
create(_Serial, _X) -> ok.
46+
validate(_X) ->
47+
ok.
4948

50-
delete(_Serial, #exchange{name = X}) ->
51-
rabbit_db_topic_exchange:delete_all_for_exchange(X).
49+
validate_binding(_X, _B) ->
50+
ok.
5251

53-
policy_changed(_X1, _X2) -> ok.
52+
create(_Serial, _X) ->
53+
ok.
5454

55-
add_binding(_Serial, _Exchange, Binding) ->
56-
rabbit_db_topic_exchange:set(Binding).
55+
delete(_Serial, _X) ->
56+
ok.
5757

58-
remove_bindings(_Serial, _X, Bs) ->
59-
rabbit_db_topic_exchange:delete(Bs).
58+
policy_changed(_X1, _X2) ->
59+
ok.
60+
61+
add_binding(_Serial, _Exchange, _Binding) ->
62+
ok.
63+
64+
remove_bindings(_Serial, _X, _Bs) ->
65+
ok.
6066

6167
assert_args_equivalence(X, Args) ->
6268
rabbit_exchange:assert_args_equivalence(X, Args).
63-
64-
%%----------------------------------------------------------------------------

0 commit comments

Comments
 (0)