zhongwencool 4 лет назад
Родитель
Сommit
c1c24af002

+ 0 - 1
apps/emqx_authz/src/emqx_authz.erl

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

+ 2 - 2
apps/emqx_machine/src/emqx_cluster_rpc.erl

@@ -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()],

+ 3 - 3
apps/emqx_resource/src/emqx_resource.erl

@@ -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).