diff --git a/cmake/cmake.define b/cmake/cmake.define index 639ae9ca3f..b89860e29f 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -1,5 +1,15 @@ cmake_minimum_required(VERSION 3.16) +if (NOT DEFINED TD_GRANT) + SET(TD_GRANT FALSE) +endif() +if (NOT DEFINED TD_USB_DONGLE) + SET(TD_USB_DONGLE FALSE) +endif() +IF (TD_GRANT) + ADD_DEFINITIONS(-D_GRANT) +ENDIF () + IF ("${BUILD_TOOLS}" STREQUAL "") IF (TD_LINUX) IF (TD_ARM_32) diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt index f498773462..297e3a08d7 100644 --- a/source/dnode/mgmt/CMakeLists.txt +++ b/source/dnode/mgmt/CMakeLists.txt @@ -23,6 +23,14 @@ target_include_directories( ) target_link_libraries(taosd dnode) +IF (TD_GRANT) + TARGET_LINK_LIBRARIES(taosd grant) +ENDIF () +IF (TD_USB_DONGLE) + TARGET_LINK_LIBRARIES(taosd usb_dongle) +else() +ENDIF () + if(${BUILD_TEST}) add_subdirectory(test) endif(${BUILD_TEST}) diff --git a/source/dnode/mgmt/exe/dndMain.c b/source/dnode/mgmt/exe/dndMain.c index 997c56f9fb..66ab2a6dcd 100644 --- a/source/dnode/mgmt/exe/dndMain.c +++ b/source/dnode/mgmt/exe/dndMain.c @@ -16,6 +16,7 @@ #define _DEFAULT_SOURCE #include "dndInt.h" #include "tconfig.h" +#include "tgrant.h" static struct { bool dumpConfig; @@ -90,8 +91,7 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) { } static void dndGenerateGrant() { - // grantParseParameter(); - printf("this feature is not implemented yet\n"); + grantParseParameter(); } static void dndPrintVersion() { diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c new file mode 100644 index 0000000000..cdf3271789 --- /dev/null +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -0,0 +1,31 @@ +/* + * 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 . + */ + +#define _DEFAULT_SOURCE +#ifndef _GRANT +#include "os.h" +#include "taoserror.h" +#include "tgrant.h" +#include "mndInt.h" + +int32_t grantInit() { return TSDB_CODE_SUCCESS; } +void grantCleanUp() {} +void grantParseParameter() { mError("can't parsed parameter k"); } +int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; } +void grantReset(EGrantType grant, uint64_t value) {} +void grantAdd(EGrantType grant, uint64_t value) {} +void grantRestore(EGrantType grant, uint64_t value) {} + +#endif \ No newline at end of file