From 92304770b777d7ab5f42e52b3122e5eb9ac84ea8 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Mon, 11 May 2026 17:45:37 +0800 Subject: [PATCH] apps --- apps/endpoint/rebar.config | 1 + apps/endpoint/src/endpoint.app.src | 24 +++++++++++++++++++ .../endpoint/src}/endpoint.erl | 0 apps/endpoint/src/endpoint_app.erl | 15 ++++++++++++ .../endpoint/src}/endpoint_buffer.erl | 0 .../endpoint/src}/endpoint_http.erl | 0 .../endpoint/src}/endpoint_kafka.erl | 0 .../endpoint/src}/endpoint_log.erl | 0 .../endpoint/src}/endpoint_mqtt.erl | 0 .../endpoint/src}/endpoint_outbox.erl | 0 .../endpoint/src}/endpoint_subscription.erl | 0 .../endpoint/src}/endpoint_sup.erl | 0 .../endpoint/src}/endpoint_sup_sup.erl | 0 {priv => apps/iot/priv}/ssl/server.crt | 0 {priv => apps/iot/priv}/ssl/server.csr | 0 {priv => apps/iot/priv}/ssl/server.key | 0 apps/iot/rebar.config | 1 + .../adapters/control_api/iot_api_client.erl | 0 .../src}/adapters/influxdb/influx_client.erl | 0 .../src}/adapters/influxdb/influx_point.erl | 0 .../iot/src}/adapters/redis/redis_client.erl | 0 {src => apps/iot/src}/codec/line_format.erl | 0 .../iot/src}/devtools/endpoint_kafka_test.erl | 0 .../devtools/endpoint_mqtt_subscriber.erl | 0 {src => apps/iot/src}/devtools/eval_test.erl | 0 {src => apps/iot/src}/devtools/iot_logger.erl | 0 {src => apps/iot/src}/devtools/iot_mock.erl | 0 .../iot/src}/devtools/iot_observer.erl | 0 .../src}/docker/docker_container_builder.erl | 0 .../iot/src}/host/iot_container_task.erl | 0 .../iot/src}/host/iot_container_task_sup.erl | 0 {src => apps/iot/src}/host/iot_host.erl | 0 {src => apps/iot/src}/host/iot_host_sup.erl | 0 .../iot/src}/http/container_handler.erl | 0 .../iot/src}/http/endpoint_handler.erl | 0 .../iot/src}/http/event_stream_handler.erl | 0 {src => apps/iot/src}/http/host_handler.erl | 0 {src => apps/iot/src}/http/http_protocol.erl | 0 {src => apps/iot/src}/iot.app.src | 0 {src => apps/iot/src}/iot_app.erl | 0 {src => apps/iot/src}/iot_log.erl | 0 {src => apps/iot/src}/iot_sup.erl | 9 ------- {src => apps/iot/src}/iot_util.erl | 0 .../iot/src}/mnesia/efka_client_store.erl | 0 {src => apps/iot/src}/mnesia/iot_mnesia.erl | 0 .../src}/simulator/simulator_api_handler.erl | 0 .../iot/src}/transport/ssl_channel.erl | 0 .../iot/src}/transport/udp_server.erl | 0 rebar.config | 5 +++- 49 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 apps/endpoint/rebar.config create mode 100644 apps/endpoint/src/endpoint.app.src rename {src/endpoint => apps/endpoint/src}/endpoint.erl (100%) create mode 100644 apps/endpoint/src/endpoint_app.erl rename {src/endpoint => apps/endpoint/src}/endpoint_buffer.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_http.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_kafka.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_log.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_mqtt.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_outbox.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_subscription.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_sup.erl (100%) rename {src/endpoint => apps/endpoint/src}/endpoint_sup_sup.erl (100%) rename {priv => apps/iot/priv}/ssl/server.crt (100%) rename {priv => apps/iot/priv}/ssl/server.csr (100%) rename {priv => apps/iot/priv}/ssl/server.key (100%) create mode 100644 apps/iot/rebar.config rename {src => apps/iot/src}/adapters/control_api/iot_api_client.erl (100%) rename {src => apps/iot/src}/adapters/influxdb/influx_client.erl (100%) rename {src => apps/iot/src}/adapters/influxdb/influx_point.erl (100%) rename {src => apps/iot/src}/adapters/redis/redis_client.erl (100%) rename {src => apps/iot/src}/codec/line_format.erl (100%) rename {src => apps/iot/src}/devtools/endpoint_kafka_test.erl (100%) rename {src => apps/iot/src}/devtools/endpoint_mqtt_subscriber.erl (100%) rename {src => apps/iot/src}/devtools/eval_test.erl (100%) rename {src => apps/iot/src}/devtools/iot_logger.erl (100%) rename {src => apps/iot/src}/devtools/iot_mock.erl (100%) rename {src => apps/iot/src}/devtools/iot_observer.erl (100%) rename {src => apps/iot/src}/docker/docker_container_builder.erl (100%) rename {src => apps/iot/src}/host/iot_container_task.erl (100%) rename {src => apps/iot/src}/host/iot_container_task_sup.erl (100%) rename {src => apps/iot/src}/host/iot_host.erl (100%) rename {src => apps/iot/src}/host/iot_host_sup.erl (100%) rename {src => apps/iot/src}/http/container_handler.erl (100%) rename {src => apps/iot/src}/http/endpoint_handler.erl (100%) rename {src => apps/iot/src}/http/event_stream_handler.erl (100%) rename {src => apps/iot/src}/http/host_handler.erl (100%) rename {src => apps/iot/src}/http/http_protocol.erl (100%) rename {src => apps/iot/src}/iot.app.src (100%) rename {src => apps/iot/src}/iot_app.erl (100%) rename {src => apps/iot/src}/iot_log.erl (100%) rename {src => apps/iot/src}/iot_sup.erl (89%) rename {src => apps/iot/src}/iot_util.erl (100%) rename {src => apps/iot/src}/mnesia/efka_client_store.erl (100%) rename {src => apps/iot/src}/mnesia/iot_mnesia.erl (100%) rename {src => apps/iot/src}/simulator/simulator_api_handler.erl (100%) rename {src => apps/iot/src}/transport/ssl_channel.erl (100%) rename {src => apps/iot/src}/transport/udp_server.erl (100%) diff --git a/apps/endpoint/rebar.config b/apps/endpoint/rebar.config new file mode 100644 index 0000000..4f604c6 --- /dev/null +++ b/apps/endpoint/rebar.config @@ -0,0 +1 @@ +{erl_opts, [debug_info, {i, "include"}, {i, "../../include"}, {i, "../../../include"}]}. diff --git a/apps/endpoint/src/endpoint.app.src b/apps/endpoint/src/endpoint.app.src new file mode 100644 index 0000000..794990a --- /dev/null +++ b/apps/endpoint/src/endpoint.app.src @@ -0,0 +1,24 @@ +{application, endpoint, + [{description, "Endpoint OTP application"}, + {vsn, "0.1.0"}, + {registered, [ + endpoint_sup_sup, + endpoint_sup, + endpoint_subscription, + endpoint_log + ]}, + {mod, {endpoint_app, []}}, + {applications, [ + iot, + emqtt, + brod, + hackney, + gproc, + kernel, + stdlib + ]}, + {env, []}, + {modules, []}, + {licenses, ["Apache 2.0"]}, + {links, []} + ]}. diff --git a/src/endpoint/endpoint.erl b/apps/endpoint/src/endpoint.erl similarity index 100% rename from src/endpoint/endpoint.erl rename to apps/endpoint/src/endpoint.erl diff --git a/apps/endpoint/src/endpoint_app.erl b/apps/endpoint/src/endpoint_app.erl new file mode 100644 index 0000000..78cc3e4 --- /dev/null +++ b/apps/endpoint/src/endpoint_app.erl @@ -0,0 +1,15 @@ +%%%------------------------------------------------------------------- +%% @doc endpoint application entrypoint. +%% @end +%%%------------------------------------------------------------------- +-module(endpoint_app). + +-behaviour(application). + +-export([start/2, stop/1]). + +start(_StartType, _StartArgs) -> + endpoint_sup_sup:start_link(). + +stop(_State) -> + ok. diff --git a/src/endpoint/endpoint_buffer.erl b/apps/endpoint/src/endpoint_buffer.erl similarity index 100% rename from src/endpoint/endpoint_buffer.erl rename to apps/endpoint/src/endpoint_buffer.erl diff --git a/src/endpoint/endpoint_http.erl b/apps/endpoint/src/endpoint_http.erl similarity index 100% rename from src/endpoint/endpoint_http.erl rename to apps/endpoint/src/endpoint_http.erl diff --git a/src/endpoint/endpoint_kafka.erl b/apps/endpoint/src/endpoint_kafka.erl similarity index 100% rename from src/endpoint/endpoint_kafka.erl rename to apps/endpoint/src/endpoint_kafka.erl diff --git a/src/endpoint/endpoint_log.erl b/apps/endpoint/src/endpoint_log.erl similarity index 100% rename from src/endpoint/endpoint_log.erl rename to apps/endpoint/src/endpoint_log.erl diff --git a/src/endpoint/endpoint_mqtt.erl b/apps/endpoint/src/endpoint_mqtt.erl similarity index 100% rename from src/endpoint/endpoint_mqtt.erl rename to apps/endpoint/src/endpoint_mqtt.erl diff --git a/src/endpoint/endpoint_outbox.erl b/apps/endpoint/src/endpoint_outbox.erl similarity index 100% rename from src/endpoint/endpoint_outbox.erl rename to apps/endpoint/src/endpoint_outbox.erl diff --git a/src/endpoint/endpoint_subscription.erl b/apps/endpoint/src/endpoint_subscription.erl similarity index 100% rename from src/endpoint/endpoint_subscription.erl rename to apps/endpoint/src/endpoint_subscription.erl diff --git a/src/endpoint/endpoint_sup.erl b/apps/endpoint/src/endpoint_sup.erl similarity index 100% rename from src/endpoint/endpoint_sup.erl rename to apps/endpoint/src/endpoint_sup.erl diff --git a/src/endpoint/endpoint_sup_sup.erl b/apps/endpoint/src/endpoint_sup_sup.erl similarity index 100% rename from src/endpoint/endpoint_sup_sup.erl rename to apps/endpoint/src/endpoint_sup_sup.erl diff --git a/priv/ssl/server.crt b/apps/iot/priv/ssl/server.crt similarity index 100% rename from priv/ssl/server.crt rename to apps/iot/priv/ssl/server.crt diff --git a/priv/ssl/server.csr b/apps/iot/priv/ssl/server.csr similarity index 100% rename from priv/ssl/server.csr rename to apps/iot/priv/ssl/server.csr diff --git a/priv/ssl/server.key b/apps/iot/priv/ssl/server.key similarity index 100% rename from priv/ssl/server.key rename to apps/iot/priv/ssl/server.key diff --git a/apps/iot/rebar.config b/apps/iot/rebar.config new file mode 100644 index 0000000..4f604c6 --- /dev/null +++ b/apps/iot/rebar.config @@ -0,0 +1 @@ +{erl_opts, [debug_info, {i, "include"}, {i, "../../include"}, {i, "../../../include"}]}. diff --git a/src/adapters/control_api/iot_api_client.erl b/apps/iot/src/adapters/control_api/iot_api_client.erl similarity index 100% rename from src/adapters/control_api/iot_api_client.erl rename to apps/iot/src/adapters/control_api/iot_api_client.erl diff --git a/src/adapters/influxdb/influx_client.erl b/apps/iot/src/adapters/influxdb/influx_client.erl similarity index 100% rename from src/adapters/influxdb/influx_client.erl rename to apps/iot/src/adapters/influxdb/influx_client.erl diff --git a/src/adapters/influxdb/influx_point.erl b/apps/iot/src/adapters/influxdb/influx_point.erl similarity index 100% rename from src/adapters/influxdb/influx_point.erl rename to apps/iot/src/adapters/influxdb/influx_point.erl diff --git a/src/adapters/redis/redis_client.erl b/apps/iot/src/adapters/redis/redis_client.erl similarity index 100% rename from src/adapters/redis/redis_client.erl rename to apps/iot/src/adapters/redis/redis_client.erl diff --git a/src/codec/line_format.erl b/apps/iot/src/codec/line_format.erl similarity index 100% rename from src/codec/line_format.erl rename to apps/iot/src/codec/line_format.erl diff --git a/src/devtools/endpoint_kafka_test.erl b/apps/iot/src/devtools/endpoint_kafka_test.erl similarity index 100% rename from src/devtools/endpoint_kafka_test.erl rename to apps/iot/src/devtools/endpoint_kafka_test.erl diff --git a/src/devtools/endpoint_mqtt_subscriber.erl b/apps/iot/src/devtools/endpoint_mqtt_subscriber.erl similarity index 100% rename from src/devtools/endpoint_mqtt_subscriber.erl rename to apps/iot/src/devtools/endpoint_mqtt_subscriber.erl diff --git a/src/devtools/eval_test.erl b/apps/iot/src/devtools/eval_test.erl similarity index 100% rename from src/devtools/eval_test.erl rename to apps/iot/src/devtools/eval_test.erl diff --git a/src/devtools/iot_logger.erl b/apps/iot/src/devtools/iot_logger.erl similarity index 100% rename from src/devtools/iot_logger.erl rename to apps/iot/src/devtools/iot_logger.erl diff --git a/src/devtools/iot_mock.erl b/apps/iot/src/devtools/iot_mock.erl similarity index 100% rename from src/devtools/iot_mock.erl rename to apps/iot/src/devtools/iot_mock.erl diff --git a/src/devtools/iot_observer.erl b/apps/iot/src/devtools/iot_observer.erl similarity index 100% rename from src/devtools/iot_observer.erl rename to apps/iot/src/devtools/iot_observer.erl diff --git a/src/docker/docker_container_builder.erl b/apps/iot/src/docker/docker_container_builder.erl similarity index 100% rename from src/docker/docker_container_builder.erl rename to apps/iot/src/docker/docker_container_builder.erl diff --git a/src/host/iot_container_task.erl b/apps/iot/src/host/iot_container_task.erl similarity index 100% rename from src/host/iot_container_task.erl rename to apps/iot/src/host/iot_container_task.erl diff --git a/src/host/iot_container_task_sup.erl b/apps/iot/src/host/iot_container_task_sup.erl similarity index 100% rename from src/host/iot_container_task_sup.erl rename to apps/iot/src/host/iot_container_task_sup.erl diff --git a/src/host/iot_host.erl b/apps/iot/src/host/iot_host.erl similarity index 100% rename from src/host/iot_host.erl rename to apps/iot/src/host/iot_host.erl diff --git a/src/host/iot_host_sup.erl b/apps/iot/src/host/iot_host_sup.erl similarity index 100% rename from src/host/iot_host_sup.erl rename to apps/iot/src/host/iot_host_sup.erl diff --git a/src/http/container_handler.erl b/apps/iot/src/http/container_handler.erl similarity index 100% rename from src/http/container_handler.erl rename to apps/iot/src/http/container_handler.erl diff --git a/src/http/endpoint_handler.erl b/apps/iot/src/http/endpoint_handler.erl similarity index 100% rename from src/http/endpoint_handler.erl rename to apps/iot/src/http/endpoint_handler.erl diff --git a/src/http/event_stream_handler.erl b/apps/iot/src/http/event_stream_handler.erl similarity index 100% rename from src/http/event_stream_handler.erl rename to apps/iot/src/http/event_stream_handler.erl diff --git a/src/http/host_handler.erl b/apps/iot/src/http/host_handler.erl similarity index 100% rename from src/http/host_handler.erl rename to apps/iot/src/http/host_handler.erl diff --git a/src/http/http_protocol.erl b/apps/iot/src/http/http_protocol.erl similarity index 100% rename from src/http/http_protocol.erl rename to apps/iot/src/http/http_protocol.erl diff --git a/src/iot.app.src b/apps/iot/src/iot.app.src similarity index 100% rename from src/iot.app.src rename to apps/iot/src/iot.app.src diff --git a/src/iot_app.erl b/apps/iot/src/iot_app.erl similarity index 100% rename from src/iot_app.erl rename to apps/iot/src/iot_app.erl diff --git a/src/iot_log.erl b/apps/iot/src/iot_log.erl similarity index 100% rename from src/iot_log.erl rename to apps/iot/src/iot_log.erl diff --git a/src/iot_sup.erl b/apps/iot/src/iot_sup.erl similarity index 89% rename from src/iot_sup.erl rename to apps/iot/src/iot_sup.erl index fccda27..d12f3a4 100644 --- a/src/iot_sup.erl +++ b/apps/iot/src/iot_sup.erl @@ -46,15 +46,6 @@ init([]) -> modules => ['udp_server'] }, - #{ - id => endpoint_sup_sup, - start => {'endpoint_sup_sup', start_link, []}, - restart => permanent, - shutdown => 2000, - type => supervisor, - modules => ['endpoint_sup_sup'] - }, - #{ id => 'iot_host_sup', start => {'iot_host_sup', start_link, []}, diff --git a/src/iot_util.erl b/apps/iot/src/iot_util.erl similarity index 100% rename from src/iot_util.erl rename to apps/iot/src/iot_util.erl diff --git a/src/mnesia/efka_client_store.erl b/apps/iot/src/mnesia/efka_client_store.erl similarity index 100% rename from src/mnesia/efka_client_store.erl rename to apps/iot/src/mnesia/efka_client_store.erl diff --git a/src/mnesia/iot_mnesia.erl b/apps/iot/src/mnesia/iot_mnesia.erl similarity index 100% rename from src/mnesia/iot_mnesia.erl rename to apps/iot/src/mnesia/iot_mnesia.erl diff --git a/src/simulator/simulator_api_handler.erl b/apps/iot/src/simulator/simulator_api_handler.erl similarity index 100% rename from src/simulator/simulator_api_handler.erl rename to apps/iot/src/simulator/simulator_api_handler.erl diff --git a/src/transport/ssl_channel.erl b/apps/iot/src/transport/ssl_channel.erl similarity index 100% rename from src/transport/ssl_channel.erl rename to apps/iot/src/transport/ssl_channel.erl diff --git a/src/transport/udp_server.erl b/apps/iot/src/transport/udp_server.erl similarity index 100% rename from src/transport/udp_server.erl rename to apps/iot/src/transport/udp_server.erl diff --git a/rebar.config b/rebar.config index fa6d495..944dc63 100644 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,6 @@ -{erl_opts, [debug_info]}. +{erl_opts, [debug_info, {i, "include"}]}. + +{project_app_dirs, ["apps/*"]}. {deps, [ {poolboy, ".*", {git, "https://github.com/devinus/poolboy.git", {tag, "1.5.1"}}}, @@ -14,6 +16,7 @@ {relx, [{release, {iot, "0.1.0"}, [iot, + endpoint, sasl]}, {mode, dev},