fix spec
This commit is contained in:
parent
4ec480af0b
commit
4a175bfc68
|
@ -58,17 +58,20 @@ start_link() ->
|
||||||
%% @doc Register a command
|
%% @doc Register a command
|
||||||
%% @end
|
%% @end
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
-spec register_cmd(atom(), {module(), atom()}, list()) -> true.
|
-spec register_cmd(atom(), {module(), atom()}, list()) -> ok.
|
||||||
register_cmd(Cmd, MF, Opts) ->
|
register_cmd(Cmd, MF, Opts) ->
|
||||||
gen_server:cast(?SERVER, {register_cmd, Cmd, MF, Opts}).
|
cast({register_cmd, Cmd, MF, Opts}).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% @doc Unregister a command
|
%% @doc Unregister a command
|
||||||
%% @end
|
%% @end
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
-spec unregister_cmd(atom()) -> true.
|
-spec unregister_cmd(atom()) -> ok.
|
||||||
unregister_cmd(Cmd) ->
|
unregister_cmd(Cmd) ->
|
||||||
gen_server:cast(?SERVER, {unregister_cmd, Cmd}).
|
cast({unregister_cmd, Cmd}).
|
||||||
|
|
||||||
|
cast(Msg) ->
|
||||||
|
gen_server:cast(?SERVER, Msg).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% @doc Run a command
|
%% @doc Run a command
|
||||||
|
|
|
@ -226,12 +226,12 @@ inc(Metric) ->
|
||||||
%% @doc Increase metric value
|
%% @doc Increase metric value
|
||||||
%% @end
|
%% @end
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
-spec inc(counter | gauge, atom()) -> non_neg_integer().
|
-spec inc({counter | gauge, atom()} | atom(), pos_integer()) -> non_neg_integer().
|
||||||
inc(gauge, Metric) ->
|
inc({gauge, Metric}, Val) ->
|
||||||
inc(gauge, Metric, 1);
|
inc(gauge, Metric, Val);
|
||||||
inc(counter, Metric) ->
|
inc({counter, Metric}, Val) ->
|
||||||
inc(counter, Metric, 1);
|
inc(counter, Metric, Val);
|
||||||
inc(Metric, Val) when is_atom(Metric) and is_integer(Val) ->
|
inc(Metric, Val) when is_atom(Metric) ->
|
||||||
inc(counter, Metric, Val).
|
inc(counter, Metric, Val).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -142,7 +142,7 @@ name(Id) ->
|
||||||
%% @doc Create Topic or Subscription.
|
%% @doc Create Topic or Subscription.
|
||||||
%% @end
|
%% @end
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
-spec create(topic | subscription, binary()) -> ok | {error, any()}.
|
-spec create(topic | subscription, binary() | {binary(), binary(), mqtt_qos()}) -> ok | {error, any()}.
|
||||||
create(topic, Topic) when is_binary(Topic) ->
|
create(topic, Topic) when is_binary(Topic) ->
|
||||||
Record = #mqtt_topic{topic = Topic, node = node()},
|
Record = #mqtt_topic{topic = Topic, node = node()},
|
||||||
case mnesia:transaction(fun add_topic/1, [Record]) of
|
case mnesia:transaction(fun add_topic/1, [Record]) of
|
||||||
|
|
|
@ -191,7 +191,7 @@ subscribe(SessPid, PacketId, TopicTable) ->
|
||||||
%% @doc Publish message
|
%% @doc Publish message
|
||||||
%% @end
|
%% @end
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
-spec publish(pid(), mqtt_message()) -> ok.
|
-spec publish(pid(), mqtt_message()) -> ok | {error, any()}.
|
||||||
publish(_SessPid, Msg = #mqtt_message{qos = ?QOS_0}) ->
|
publish(_SessPid, Msg = #mqtt_message{qos = ?QOS_0}) ->
|
||||||
%% publish qos0 directly
|
%% publish qos0 directly
|
||||||
emqttd_pubsub:publish(Msg);
|
emqttd_pubsub:publish(Msg);
|
||||||
|
|
Loading…
Reference in New Issue