fix(ds): Fix return types in replication_layer_meta
This commit is contained in:
parent
70396e9766
commit
d09787d1a6
|
@ -72,7 +72,7 @@
|
||||||
n_shards/1
|
n_shards/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export_type([site/0]).
|
-export_type([site/0, update_cluster_result/0]).
|
||||||
|
|
||||||
-include_lib("stdlib/include/qlc.hrl").
|
-include_lib("stdlib/include/qlc.hrl").
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
|
@ -118,6 +118,12 @@
|
||||||
%% Membership transition of shard's replica set:
|
%% Membership transition of shard's replica set:
|
||||||
-type transition() :: {add | del, site()}.
|
-type transition() :: {add | del, site()}.
|
||||||
|
|
||||||
|
-type update_cluster_result() ::
|
||||||
|
ok
|
||||||
|
| {error, {nonexistent_db, emqx_ds:db()}}
|
||||||
|
| {error, {nonexistent_sites, [site()]}}
|
||||||
|
| {error, _}.
|
||||||
|
|
||||||
%% Peristent term key:
|
%% Peristent term key:
|
||||||
-define(emqx_ds_builtin_site, emqx_ds_builtin_site).
|
-define(emqx_ds_builtin_site, emqx_ds_builtin_site).
|
||||||
|
|
||||||
|
@ -243,20 +249,17 @@ drop_db(DB) ->
|
||||||
%%===============================================================================
|
%%===============================================================================
|
||||||
|
|
||||||
%% @doc Join a site to the set of sites the DB is replicated across.
|
%% @doc Join a site to the set of sites the DB is replicated across.
|
||||||
-spec join_db_site(emqx_ds:db(), site()) ->
|
-spec join_db_site(emqx_ds:db(), site()) -> update_cluster_result().
|
||||||
ok | {error, nonexistent_db | nonexistent_sites}.
|
|
||||||
join_db_site(DB, Site) ->
|
join_db_site(DB, Site) ->
|
||||||
transaction(fun ?MODULE:modify_db_sites_trans/2, [DB, [{add, Site}]]).
|
transaction(fun ?MODULE:modify_db_sites_trans/2, [DB, [{add, Site}]]).
|
||||||
|
|
||||||
%% @doc Make a site leave the set of sites the DB is replicated across.
|
%% @doc Make a site leave the set of sites the DB is replicated across.
|
||||||
-spec leave_db_site(emqx_ds:db(), site()) ->
|
-spec leave_db_site(emqx_ds:db(), site()) -> update_cluster_result().
|
||||||
ok | {error, nonexistent_db | nonexistent_sites}.
|
|
||||||
leave_db_site(DB, Site) ->
|
leave_db_site(DB, Site) ->
|
||||||
transaction(fun ?MODULE:modify_db_sites_trans/2, [DB, [{del, Site}]]).
|
transaction(fun ?MODULE:modify_db_sites_trans/2, [DB, [{del, Site}]]).
|
||||||
|
|
||||||
%% @doc Assign a set of sites to the DB for replication.
|
%% @doc Assign a set of sites to the DB for replication.
|
||||||
-spec assign_db_sites(emqx_ds:db(), [site()]) ->
|
-spec assign_db_sites(emqx_ds:db(), [site()]) -> update_cluster_result().
|
||||||
ok | {error, nonexistent_db | nonexistent_sites}.
|
|
||||||
assign_db_sites(DB, Sites) ->
|
assign_db_sites(DB, Sites) ->
|
||||||
transaction(fun ?MODULE:assign_db_sites_trans/2, [DB, Sites]).
|
transaction(fun ?MODULE:assign_db_sites_trans/2, [DB, Sites]).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue