fix(ds-api): adapt CLI to API changes
This commit is contained in:
parent
35e360fcbe
commit
2f90d15ce6
|
@ -353,7 +353,7 @@ db_replica(delete, #{bindings := #{ds := DB, site := Site}}) ->
|
|||
-spec update_db_sites(emqx_ds:db(), [emqx_ds_replication_layer_meta:site()], rest | cli) ->
|
||||
{ok, [emqx_ds_replication_layer_meta:site()]} | {error, _}.
|
||||
update_db_sites(DB, Sites, Via) when is_list(Sites) ->
|
||||
?SLOG(notice, #{
|
||||
?SLOG(warning, #{
|
||||
msg => "durable_storage_rebalance_request", ds => DB, sites => Sites, via => Via
|
||||
}),
|
||||
meta_result_to_binary(emqx_ds_replication_layer_meta:assign_db_sites(DB, Sites));
|
||||
|
@ -363,7 +363,7 @@ update_db_sites(_, _, _) ->
|
|||
-spec join(emqx_ds:db(), emqx_ds_replication_layer_meta:site(), rest | cli) ->
|
||||
{ok, unchanged | [emqx_ds_replication_layer_meta:site()]} | {error, _}.
|
||||
join(DB, Site, Via) ->
|
||||
?SLOG(notice, #{
|
||||
?SLOG(warning, #{
|
||||
msg => "durable_storage_join_request", ds => DB, site => Site, via => Via
|
||||
}),
|
||||
meta_result_to_binary(emqx_ds_replication_layer_meta:join_db_site(DB, Site)).
|
||||
|
@ -371,7 +371,7 @@ join(DB, Site, Via) ->
|
|||
-spec leave(emqx_ds:db(), emqx_ds_replication_layer_meta:site(), rest | cli) ->
|
||||
{ok, unchanged | [emqx_ds_replication_layer_meta:site()]} | {error, _}.
|
||||
leave(DB, Site, Via) ->
|
||||
?SLOG(notice, #{
|
||||
?SLOG(warning, #{
|
||||
msg => "durable_storage_leave_request", ds => DB, site => Site, via => Via
|
||||
}),
|
||||
meta_result_to_binary(emqx_ds_replication_layer_meta:leave_db_site(DB, Site)).
|
||||
|
|
|
@ -855,7 +855,7 @@ do_ds(["set_replicas", DBStr | SitesStr]) ->
|
|||
{ok, DB} ->
|
||||
Sites = lists:map(fun list_to_binary/1, SitesStr),
|
||||
case emqx_mgmt_api_ds:update_db_sites(DB, Sites, cli) of
|
||||
ok ->
|
||||
{ok, _} ->
|
||||
emqx_ctl:print("ok~n");
|
||||
{error, Description} ->
|
||||
emqx_ctl:print("Unable to update replicas: ~s~n", [Description])
|
||||
|
@ -867,7 +867,9 @@ do_ds(["join", DBStr, Site]) ->
|
|||
case emqx_utils:safe_to_existing_atom(DBStr) of
|
||||
{ok, DB} ->
|
||||
case emqx_mgmt_api_ds:join(DB, list_to_binary(Site), cli) of
|
||||
ok ->
|
||||
{ok, unchanged} ->
|
||||
emqx_ctl:print("unchanged~n");
|
||||
{ok, _} ->
|
||||
emqx_ctl:print("ok~n");
|
||||
{error, Description} ->
|
||||
emqx_ctl:print("Unable to update replicas: ~s~n", [Description])
|
||||
|
@ -879,7 +881,9 @@ do_ds(["leave", DBStr, Site]) ->
|
|||
case emqx_utils:safe_to_existing_atom(DBStr) of
|
||||
{ok, DB} ->
|
||||
case emqx_mgmt_api_ds:leave(DB, list_to_binary(Site), cli) of
|
||||
ok ->
|
||||
{ok, unchanged} ->
|
||||
emqx_ctl:print("unchanged~n");
|
||||
{ok, _} ->
|
||||
emqx_ctl:print("ok~n");
|
||||
{error, Description} ->
|
||||
emqx_ctl:print("Unable to update replicas: ~s~n", [Description])
|
||||
|
|
Loading…
Reference in New Issue