|
20 | 20 | -export([names/1, diagnostics/1, make/1, make/2, parts/1, cookie_hash/0,
|
21 | 21 | is_running/2, is_process_running/2,
|
22 | 22 | cluster_name/0, set_cluster_name/1, set_cluster_name/2, ensure_epmd/0,
|
23 |
| - all_running/0, name_type/0, running_count/0, |
24 |
| - await_running_count/2, |
| 23 | + all_running/0, name_type/0, running_count/0, total_count/0, |
| 24 | + await_running_count/2, is_single_node_cluster/0, |
25 | 25 | boot/0]).
|
26 | 26 | -export([persistent_cluster_id/0, seed_internal_cluster_id/0, seed_user_provided_cluster_name/0]).
|
27 | 27 |
|
@@ -138,15 +138,19 @@ ensure_epmd() ->
|
138 | 138 | rabbit_nodes_common:ensure_epmd().
|
139 | 139 |
|
140 | 140 | -spec all_running() -> [node()].
|
141 |
| - |
142 | 141 | all_running() -> rabbit_mnesia:cluster_nodes(running).
|
143 | 142 |
|
144 | 143 | -spec running_count() -> integer().
|
145 |
| - |
146 | 144 | running_count() -> length(all_running()).
|
147 | 145 |
|
148 |
| --spec await_running_count(integer(), integer()) -> 'ok' | {'error', atom()}. |
| 146 | +-spec total_count() -> integer(). |
| 147 | +total_count() -> length(rabbit_mnesia:cluster_nodes(all)). |
149 | 148 |
|
| 149 | +-spec is_single_node_cluster() -> boolean(). |
| 150 | +is_single_node_cluster() -> |
| 151 | + total_count() =:= 1. |
| 152 | + |
| 153 | +-spec await_running_count(integer(), integer()) -> 'ok' | {'error', atom()}. |
150 | 154 | await_running_count(TargetCount, Timeout) ->
|
151 | 155 | Retries = round(Timeout/?SAMPLING_INTERVAL),
|
152 | 156 | await_running_count_with_retries(TargetCount, Retries).
|
|
0 commit comments