refactor(emqx_trie): rename internal function to match_#

This commit is contained in:
Zaiming Shi 2021-04-26 12:15:13 +02:00 committed by Zaiming (Stone) Shi
parent 8d55d425dc
commit b1df759adc
1 changed files with 3 additions and 3 deletions

View File

@ -221,7 +221,7 @@ do_match(Words, Prefix) ->
match(is_compact(), Words, Prefix, []). match(is_compact(), Words, Prefix, []).
match(_IsCompact, [], Topic, Acc) -> match(_IsCompact, [], Topic, Acc) ->
match_any_level(Topic) ++ %% try match foo/bar/# 'match_#'(Topic) ++ %% try match foo/bar/#
lookup_topic(Topic) ++ %% try match foo/bar lookup_topic(Topic) ++ %% try match foo/bar
Acc; Acc;
match(IsCompact, [Word | Words], Prefix, Acc0) -> match(IsCompact, [Word | Words], Prefix, Acc0) ->
@ -251,12 +251,12 @@ match(IsCompact, [Word | Words], Prefix, Acc0) ->
%% - a/x %% - a/x
%% - a/x/y %% - a/x/y
%% *with '+', '#' replaced at each level %% *with '+', '#' replaced at each level
Acc1 = match_any_level(Prefix) ++ Acc0, Acc1 = 'match_#'(Prefix) ++ Acc0,
Acc = match(IsCompact, Words, join(Prefix, '+'), Acc1), Acc = match(IsCompact, Words, join(Prefix, '+'), Acc1),
match(IsCompact, Words, join(Prefix, Word), Acc) match(IsCompact, Words, join(Prefix, Word), Acc)
end. end.
match_any_level(Prefix) -> 'match_#'(Prefix) ->
MlTopic = join(Prefix, '#'), MlTopic = join(Prefix, '#'),
lookup_topic(MlTopic). lookup_topic(MlTopic).