提交 75d6e777 编写于 作者: K kailixu

enh: support taosd -u

上级 289f197a
...@@ -27,6 +27,7 @@ static void sigintHandler(int32_t signum, void *sigInfo, void *context); ...@@ -27,6 +27,7 @@ static void sigintHandler(int32_t signum, void *sigInfo, void *context);
int32_t main(int32_t argc, char *argv[]) { int32_t main(int32_t argc, char *argv[]) {
int dump_config = 0; int dump_config = 0;
int dump_cluster = 0;
// Set global configuration file // Set global configuration file
for (int32_t i = 1; i < argc; ++i) { for (int32_t i = 1; i < argc; ++i) {
...@@ -61,8 +62,10 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -61,8 +62,10 @@ int32_t main(int32_t argc, char *argv[]) {
printf("buildinfo: %s\n", buildinfo); printf("buildinfo: %s\n", buildinfo);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} else if (strcmp(argv[i], "-k") == 0) { } else if (strcmp(argv[i], "-k") == 0) {
grantParseParameter(); grantParseParameter(argv[i]);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} else if (strcmp(argv[i], "-u") == 0) {
dump_cluster = 1;
} else if (strcmp(argv[i], "-A") == 0) { } else if (strcmp(argv[i], "-A") == 0) {
tsPrintAuth = 1; tsPrintAuth = 1;
} }
...@@ -115,6 +118,13 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -115,6 +118,13 @@ int32_t main(int32_t argc, char *argv[]) {
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
if (0 != dump_cluster) {
taosInitGlobalCfg();
taosReadGlobalCfg();
grantParseParameter("-u");
exit(EXIT_SUCCESS);
}
if (tsem_init(&exitSem, 0, 0) != 0) { if (tsem_init(&exitSem, 0, 0) != 0) {
printf("failed to create exit semphore\n"); printf("failed to create exit semphore\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
...@@ -38,7 +38,7 @@ typedef enum { ...@@ -38,7 +38,7 @@ typedef enum {
int32_t grantInit(); int32_t grantInit();
void grantCleanUp(); void grantCleanUp();
void grantParseParameter(); void grantParseParameter(const char* param);
int32_t grantCheck(EGrantType grant); int32_t grantCheck(EGrantType grant);
void grantReset(EGrantType grant, uint64_t value); void grantReset(EGrantType grant, uint64_t value);
void grantAdd(EGrantType grant, uint64_t value); void grantAdd(EGrantType grant, uint64_t value);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
int32_t grantInit() { return TSDB_CODE_SUCCESS; } int32_t grantInit() { return TSDB_CODE_SUCCESS; }
void grantCleanUp() {} void grantCleanUp() {}
void grantParseParameter() { mError("can't parsed parameter k"); } void grantParseParameter(const char* param) { mError("can't parse parameter %s", param); }
int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; } int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; }
void grantReset(EGrantType grant, uint64_t value) {} void grantReset(EGrantType grant, uint64_t value) {}
void grantAdd(EGrantType grant, uint64_t value) {} void grantAdd(EGrantType grant, uint64_t value) {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册