fix: dialyzer warning

This commit is contained in:
zhongwencool 2021-08-26 18:12:21 +08:00
parent 73238ed81f
commit c1c24af002
3 changed files with 5 additions and 6 deletions

View File

@ -216,7 +216,6 @@ create_resource(#{type := DB,
Config,
[])
of
{ok, already_created} -> ResourceID;
{ok, _} -> ResourceID;
{error, Reason} -> {error, Reason}
end;

View File

@ -69,7 +69,7 @@ start_link() ->
start_link(Node, Name, RetryMs) ->
gen_server:start_link({local, Name}, ?MODULE, [Node, RetryMs], []).
-spec multicall(Module, Function, Args) -> {ok, TnxId} | {error, Reason} when
-spec multicall(Module, Function, Args) -> {ok, TnxId, term()} | {error, Reason} when
Module :: module(),
Function :: atom(),
Args :: [term()],
@ -78,7 +78,7 @@ start_link(Node, Name, RetryMs) ->
multicall(M, F, A) ->
multicall(M, F, A, timer:minutes(2)).
-spec multicall(Module, Function, Args, Timeout) -> {ok, TnxId} |{error, Reason} when
-spec multicall(Module, Function, Args, Timeout) -> {ok, TnxId, term()} |{error, Reason} when
Module :: module(),
Function :: atom(),
Args :: [term()],

View File

@ -155,12 +155,12 @@ query_failed({_, {OnFailed, Args}}) ->
%% APIs for resource instances
%% =================================================================================
-spec create(instance_id(), resource_type(), resource_config()) ->
{ok, resource_data()} | {error, Reason :: term()}.
{ok, resource_data() |'already_created'} | {error, Reason :: term()}.
create(InstId, ResourceType, Config) ->
cluster_call(create_local, [InstId, ResourceType, Config]).
-spec create_local(instance_id(), resource_type(), resource_config()) ->
{ok, resource_data()} | {error, Reason :: term()}.
{ok, resource_data() | 'already_created'} | {error, Reason :: term()}.
create_local(InstId, ResourceType, Config) ->
call_instance(InstId, {create, InstId, ResourceType, Config}).
@ -285,7 +285,7 @@ check_config(ResourceType, RawConfigTerm) ->
end.
-spec check_and_create(instance_id(), resource_type(), raw_resource_config()) ->
{ok, resource_data()} | {error, term()}.
{ok, resource_data() |'already_created'} | {error, term()}.
check_and_create(InstId, ResourceType, RawConfig) ->
check_and_do(ResourceType, RawConfig,
fun(InstConf) -> create(InstId, ResourceType, InstConf) end).