diff --git a/CMakeLists.txt b/CMakeLists.txt index be97e679d1c2ca6229013a96e8946d6a18068ed3..0e3745db3bf5be55cbe7b6173a5e9e7fae59e74d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ SET(TD_GRANT FALSE) SET(TD_MQTT FALSE) SET(TD_TSDB_PLUGINS FALSE) SET(TD_STORAGE FALSE) -SET(TD_TOPIC FALSE) +SET(TD_MODULE FALSE) SET(TD_COVER FALSE) SET(TD_MEM_CHECK FALSE) diff --git a/cmake/define.inc b/cmake/define.inc index ff4583d02bd924f59701a8302a2e9d8dbb32a14f..6f49630d5c25d0f1519f3e6c606fe28a026add2d 100755 --- a/cmake/define.inc +++ b/cmake/define.inc @@ -29,6 +29,10 @@ IF (TD_TOPIC) ADD_DEFINITIONS(-D_TOPIC) ENDIF () +IF (TD_MODULE) + ADD_DEFINITIONS(-D_MODULE) +ENDIF () + IF (TD_GODLL) ADD_DEFINITIONS(-D_TD_GO_DLL_) ENDIF () diff --git a/cmake/input.inc b/cmake/input.inc index b1a993c996724d6f8948d98de3600db856a09c86..00e0e1bc0f00fd8ba8e679f93d5f75e1b75e6bcd 100755 --- a/cmake/input.inc +++ b/cmake/input.inc @@ -17,6 +17,14 @@ ELSEIF (${TOPIC} MATCHES "false") MESSAGE(STATUS "Build without topic plugins") ENDIF () +IF (${TD_MODULE} MATCHES "true") + SET(TD_MODULE TRUE) + MESSAGE(STATUS "Build with module plugins") +ELSEIF (${TOPIC} MATCHES "false") + SET(TD_MODULE FALSE) + MESSAGE(STATUS "Build without module plugins") +ENDIF () + IF (${COVER} MATCHES "true") SET(TD_COVER TRUE) MESSAGE(STATUS "Build with test coverage") diff --git a/src/dnode/CMakeLists.txt b/src/dnode/CMakeLists.txt index 516e5b4d1f59f432bc7cac402854b491ba0569ff..dd18f0092024834c8cb0d230b27f5905ea2339df 100644 --- a/src/dnode/CMakeLists.txt +++ b/src/dnode/CMakeLists.txt @@ -35,6 +35,10 @@ IF (TD_TOPIC) TARGET_LINK_LIBRARIES(taosd topic) ENDIF () +IF (TD_MODULE AND TD_LINUX) + TARGET_LINK_LIBRARIES(taosd module dl) +ENDIF () + SET(PREPARE_ENV_CMD "prepare_env_cmd") SET(PREPARE_ENV_TARGET "prepare_env_target") ADD_CUSTOM_COMMAND(OUTPUT ${PREPARE_ENV_CMD} diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index c24eac84cf1796e05b2ee73e069067adbaf619a4..8ac712386ec3ec4c05f60dd41b9f22f20d59203a 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -39,6 +39,12 @@ #include "dnodeMPeer.h" #include "dnodeShell.h" #include "dnodeTelemetry.h" +#include "module.h" + +#ifndef _MODULE +int32_t moduleStart() { return 0; } +void moduleStop(); +#endif void *tsDnodeTmr = NULL; static SRunStatus tsRunStatus = TSDB_RUN_STATUS_STOPPED; @@ -146,6 +152,7 @@ int32_t dnodeInitSystem() { } dnodeSetRunStatus(TSDB_RUN_STATUS_RUNING); + moduleStart(); dnodeReportStep("TDengine", "initialized successfully", 1); dInfo("TDengine is initialized successfully"); @@ -155,6 +162,7 @@ int32_t dnodeInitSystem() { void dnodeCleanUpSystem() { if (dnodeGetRunStatus() != TSDB_RUN_STATUS_STOPPED) { + moduleStop(); dnodeSetRunStatus(TSDB_RUN_STATUS_STOPPED); dnodeCleanupTmr(); dnodeCleanupComponents(); diff --git a/src/inc/module.h b/src/inc/module.h new file mode 100644 index 0000000000000000000000000000000000000000..b9b64c493ec5777ddd6981ebf3212ffd0ff0114d --- /dev/null +++ b/src/inc/module.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_MODULE +#define TDENGINE_MODULE + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t moduleStart(); +void moduleStop(); + +#ifdef __cplusplus +} +#endif + +#endif