chore: add some typing

This commit is contained in:
William Yang 2022-11-02 09:46:48 +01:00
parent 00b59b4939
commit 2d09a054e3
4 changed files with 9 additions and 4 deletions

View File

@ -24,7 +24,7 @@ IsQuicSupp = fun() ->
end, end,
Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}}, Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}},
Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.16"}}}. Quicer = {quicer, {git, "https://github.com/qzhuyan/quic.git", {branch, "dev/william/multi-streams"}}}. %% @TODO revert
ExtraDeps = fun(C) -> ExtraDeps = fun(C) ->
{deps, Deps0} = lists:keyfind(deps, 1, C), {deps, Deps0} = lists:keyfind(deps, 1, C),

View File

@ -40,9 +40,11 @@
new_stream/3 new_stream/3
]). ]).
-type cb_state() :: map() | proplists:proplist(). -type cb_state() :: map().
-type cb_ret() :: ok. -type cb_ret() :: ok.
-spec init(map() | list()) -> cb_state().
init(ConnOpts) when is_list(ConnOpts) -> init(ConnOpts) when is_list(ConnOpts) ->
init(maps:from_list(ConnOpts)); init(maps:from_list(ConnOpts));
init(#{stream_opts := SOpts} = S) when is_list(SOpts) -> init(#{stream_opts := SOpts} = S) when is_list(SOpts) ->
@ -50,6 +52,8 @@ init(#{stream_opts := SOpts} = S) when is_list(SOpts) ->
init(ConnOpts) when is_map(ConnOpts) -> init(ConnOpts) when is_map(ConnOpts) ->
{ok, ConnOpts}. {ok, ConnOpts}.
-spec closed(quicer:conneciton_hanlder(), quicer:conn_closed_props(), cb_state()) ->
{ok, cb_state()} | {error, any()}.
closed(_Conn, #{is_peer_acked := true}, S) -> closed(_Conn, #{is_peer_acked := true}, S) ->
{stop, normal, S}; {stop, normal, S};
closed(_Conn, #{is_peer_acked := false}, S) -> closed(_Conn, #{is_peer_acked := false}, S) ->

View File

@ -62,7 +62,7 @@
, {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.3"}}} , {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.3"}}}
, {replayq, {git, "https://github.com/emqx/replayq.git", {tag, "0.3.7"}}} , {replayq, {git, "https://github.com/emqx/replayq.git", {tag, "0.3.7"}}}
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}} , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.7.0"}}} , {emqtt, {git, "https://github.com/qzhuyan/emqtt", {branch, "dev/william/multi-streams"}}} %% @TODO revert
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}} , {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}}
, {observer_cli, "1.7.1"} % NOTE: depends on recon 2.5.x , {observer_cli, "1.7.1"} % NOTE: depends on recon 2.5.x
, {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}} , {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}}

View File

@ -39,7 +39,8 @@ bcrypt() ->
{bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}}. {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}}.
quicer() -> quicer() ->
{quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.16"}}}. %% @TODO revert
{quicer, {git, "https://github.com/qzhuyan/quic.git", {branch, "dev/william/multi-streams"}}}.
jq() -> jq() ->
{jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.9"}}}. {jq, {git, "https://github.com/emqx/jq", {tag, "v0.3.9"}}}.