chore(mqttconn): remove dead code

This commit is contained in:
Andrew Mayorov 2023-05-18 20:44:20 +03:00
parent aa096f496f
commit 4da0d83faf
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
2 changed files with 2 additions and 74 deletions

View File

@ -15,10 +15,6 @@
%%--------------------------------------------------------------------
-module(emqx_connector_mqtt).
-include("emqx_connector.hrl").
-include_lib("typerefl/include/types.hrl").
-include_lib("hocon/include/hoconsc.hrl").
-include_lib("emqx/include/logger.hrl").
-behaviour(supervisor).
@ -47,52 +43,6 @@
-export([on_async_result/2]).
-behaviour(hocon_schema).
-import(hoconsc, [mk/2]).
-export([
roots/0,
fields/1
]).
%%=====================================================================
%% Hocon schema
roots() ->
fields("config").
fields("config") ->
emqx_connector_mqtt_schema:fields("config");
fields("get") ->
[
{num_of_bridges,
mk(
integer(),
#{desc => ?DESC("num_of_bridges")}
)}
] ++ fields("post");
fields("put") ->
emqx_connector_mqtt_schema:fields("server_configs");
fields("post") ->
[
{type,
mk(
mqtt,
#{
required => true,
desc => ?DESC("type")
}
)},
{name,
mk(
binary(),
#{
required => true,
desc => ?DESC("name")
}
)}
] ++ fields("put").
%% ===================================================================
%% supervisor APIs
start_link() ->
@ -313,7 +263,7 @@ maybe_put_fields(Fields, Conf, Acc0) ->
ms_to_s(Ms) ->
erlang:ceil(Ms / 1000).
clientid(Id, _Conf = #{clientid_prefix := Prefix = <<_/binary>>}) ->
clientid(Id, _Conf = #{clientid_prefix := Prefix}) when is_binary(Prefix) ->
iolist_to_binary([Prefix, ":", Id, ":", atom_to_list(node())]);
clientid(Id, _Conf) ->
iolist_to_binary([Id, ":", atom_to_list(node())]).

View File

@ -17,12 +17,9 @@
-module(emqx_connector_mqtt_msg).
-export([
to_binary/1,
from_binary/1,
make_pub_vars/2,
to_remote_msg/2,
to_broker_msg/3,
estimate_size/1
to_broker_msg/3
]).
-export([
@ -143,25 +140,6 @@ replace_simple_var(Tokens, Data) when is_list(Tokens) ->
replace_simple_var(Val, _Data) ->
Val.
%% @doc Make `binary()' in order to make iodata to be persisted on disk.
-spec to_binary(msg()) -> binary().
to_binary(Msg) -> term_to_binary(Msg).
%% @doc Unmarshal binary into `msg()'.
-spec from_binary(binary()) -> msg().
from_binary(Bin) -> binary_to_term(Bin).
%% @doc Estimate the size of a message.
%% Count only the topic length + payload size
%% There is no topic and payload for event message. So count all `Msg` term
-spec estimate_size(msg()) -> integer().
estimate_size(#message{topic = Topic, payload = Payload}) ->
size(Topic) + size(Payload);
estimate_size(#{topic := Topic, payload := Payload}) ->
size(Topic) + size(Payload);
estimate_size(Term) ->
erlang:external_size(Term).
set_headers(Val, Msg) ->
emqx_message:set_headers(Val, Msg).
topic(undefined, Topic) -> Topic;