Skip to content

Commit

Permalink
Merge pull request #12065 from rabbitmq/list-exchange-names-from-khep…
Browse files Browse the repository at this point in the history
…ri-projection

rabbit_db_exchange: List exchange names from Khepri projection
  • Loading branch information
dumbbell authored Aug 21, 2024
2 parents 6394413 + 20f2850 commit 36aa94a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions deps/rabbit/src/rabbit_db_exchange.erl
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ list_in_mnesia() ->
mnesia:dirty_all_keys(?MNESIA_TABLE).

list_in_khepri() ->
case rabbit_khepri:match(khepri_exchanges_path() ++
[rabbit_khepri:if_has_data_wildcard()]) of
{ok, Map} ->
maps:fold(fun(_K, X, Acc) -> [X#exchange.name | Acc] end, [], Map);
_ ->
try
ets:foldr(
fun(#exchange{name = Name}, Acc) ->
[Name | Acc]
end, [], ?KHEPRI_PROJECTION)
catch
error:badarg ->
[]
end.

Expand Down

0 comments on commit 36aa94a

Please sign in to comment.