[TD-16]
This commit is contained in:
parent
0d4852ca0e
commit
7c89da9864
|
@ -28,20 +28,9 @@
|
||||||
#include "dnodeRead.h"
|
#include "dnodeRead.h"
|
||||||
#include "dnodeShell.h"
|
#include "dnodeShell.h"
|
||||||
#include "dnodeWrite.h"
|
#include "dnodeWrite.h"
|
||||||
#ifdef CLUSTER
|
|
||||||
#include "account.h"
|
|
||||||
#include "admin.h"
|
|
||||||
#include "balance.h"
|
|
||||||
#include "cluster.h"
|
|
||||||
#include "grant.h"
|
|
||||||
#include "mpeer.h"
|
|
||||||
#include "storage.h"
|
|
||||||
#include "vpeer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int32_t dnodeInitSystem();
|
static int32_t dnodeInitSystem();
|
||||||
static int32_t dnodeInitStorage();
|
static int32_t dnodeInitStorage();
|
||||||
static void dnodeInitPlugins();
|
|
||||||
static void dnodeCleanupStorage();
|
static void dnodeCleanupStorage();
|
||||||
static void dnodeCleanUpSystem();
|
static void dnodeCleanUpSystem();
|
||||||
static void dnodeSetRunStatus(SDnodeRunStatus status);
|
static void dnodeSetRunStatus(SDnodeRunStatus status);
|
||||||
|
@ -51,8 +40,6 @@ static SDnodeRunStatus tsDnodeRunStatus = TSDB_DNODE_RUN_STATUS_STOPPED;
|
||||||
void (*dnodeParseParameterKFp)() = NULL;
|
void (*dnodeParseParameterKFp)() = NULL;
|
||||||
|
|
||||||
int32_t main(int32_t argc, char *argv[]) {
|
int32_t main(int32_t argc, char *argv[]) {
|
||||||
dnodeInitPlugins();
|
|
||||||
|
|
||||||
// Set global configuration file
|
// Set global configuration file
|
||||||
for (int32_t i = 1; i < argc; ++i) {
|
for (int32_t i = 1; i < argc; ++i) {
|
||||||
if (strcmp(argv[i], "-c") == 0) {
|
if (strcmp(argv[i], "-c") == 0) {
|
||||||
|
@ -244,15 +231,3 @@ static int32_t dnodeInitStorage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dnodeCleanupStorage() {}
|
static void dnodeCleanupStorage() {}
|
||||||
|
|
||||||
static void dnodeInitPlugins() {
|
|
||||||
#ifdef CLUSTER
|
|
||||||
// acctInit();
|
|
||||||
// adminInit();
|
|
||||||
// balanceInit();
|
|
||||||
// clusterInit();
|
|
||||||
// grantInit();
|
|
||||||
// mpeerInit();
|
|
||||||
// storageInit();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
|
@ -213,7 +213,8 @@ typedef struct _acctObj {
|
||||||
SAcctCfg cfg;
|
SAcctCfg cfg;
|
||||||
int32_t acctId;
|
int32_t acctId;
|
||||||
int64_t createdTime;
|
int64_t createdTime;
|
||||||
int8_t reserved[15];
|
int8_t dirty;
|
||||||
|
int8_t reserved[14];
|
||||||
int8_t updateEnd[1];
|
int8_t updateEnd[1];
|
||||||
SAcctInfo acctInfo;
|
SAcctInfo acctInfo;
|
||||||
SDbObj * pHead;
|
SDbObj * pHead;
|
||||||
|
|
|
@ -27,7 +27,7 @@ SAcctObj *mgmtGetAcct(char *acctName);
|
||||||
|
|
||||||
int32_t mgmtCheckUserLimit(SAcctObj *pAcct);
|
int32_t mgmtCheckUserLimit(SAcctObj *pAcct);
|
||||||
int32_t mgmtCheckDbLimit(SAcctObj *pAcct);
|
int32_t mgmtCheckDbLimit(SAcctObj *pAcct);
|
||||||
int32_t mgmtCheckTableLimit(SAcctObj *pAcct, int32_t numOfTimeSeries);
|
int32_t mgmtCheckTableLimit(SAcctObj *pAcct);
|
||||||
|
|
||||||
int32_t mgmtAddDbIntoAcct(SAcctObj *pAcct, SDbObj *pDb);
|
int32_t mgmtAddDbIntoAcct(SAcctObj *pAcct, SDbObj *pDb);
|
||||||
int32_t mgmtRemoveDbFromAcct(SAcctObj *pAcct, SDbObj *pDb);
|
int32_t mgmtRemoveDbFromAcct(SAcctObj *pAcct, SDbObj *pDb);
|
||||||
|
|
|
@ -15,16 +15,10 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
#include "mnode.h"
|
||||||
#include "mgmtAcct.h"
|
#include "mgmtAcct.h"
|
||||||
|
|
||||||
static SAcctObj tsAcctObj;
|
static SAcctObj tsAcctObj = {0};
|
||||||
|
|
||||||
int32_t (*mgmtInitAcctsFp)() = NULL;
|
|
||||||
void (*mgmtCleanUpAcctsFp)() = NULL;
|
|
||||||
SAcctObj *(*mgmtGetAcctFp)(char *acctName) = NULL;
|
|
||||||
int32_t (*mgmtCheckUserLimitFp)(SAcctObj *pAcct) = NULL;
|
|
||||||
int32_t (*mgmtCheckDbLimitFp)(SAcctObj *pAcct) = NULL;
|
|
||||||
int32_t (*mgmtCheckTableLimitFp)(SAcctObj *pAcct, int32_t numOfTimeSeries) = NULL;
|
|
||||||
|
|
||||||
int32_t mgmtAddDbIntoAcct(SAcctObj *pAcct, SDbObj *pDb) {
|
int32_t mgmtAddDbIntoAcct(SAcctObj *pAcct, SDbObj *pDb) {
|
||||||
pthread_mutex_lock(&pAcct->mutex);
|
pthread_mutex_lock(&pAcct->mutex);
|
||||||
|
@ -99,49 +93,22 @@ int32_t mgmtRemoveUserFromAcct(SAcctObj *pAcct, SUserObj *pUser) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _ACCOUNT
|
||||||
|
|
||||||
int32_t mgmtInitAccts() {
|
int32_t mgmtInitAccts() {
|
||||||
if (mgmtInitAcctsFp) {
|
tsAcctObj.acctId = 0;
|
||||||
return (*mgmtInitAcctsFp)();
|
strcpy(tsAcctObj.user, "root");
|
||||||
} else {
|
return TSDB_CODE_SUCCESS;
|
||||||
tsAcctObj.acctId = 0;
|
|
||||||
strcpy(tsAcctObj.user, "root");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SAcctObj *mgmtGetAcct(char *acctName) {
|
SAcctObj *mgmtGetAcct(char *acctName) { return &tsAcctObj; }
|
||||||
if (mgmtGetAcctFp) {
|
|
||||||
return (*mgmtGetAcctFp)(acctName);
|
|
||||||
} else {
|
|
||||||
return &tsAcctObj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mgmtCleanUpAccts() {
|
void mgmtCleanUpAccts() {}
|
||||||
if (mgmtCleanUpAcctsFp) {
|
|
||||||
(*mgmtCleanUpAcctsFp)();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mgmtCheckUserLimit(SAcctObj *pAcct) {
|
int32_t mgmtCheckUserLimit(SAcctObj *pAcct) { return TSDB_CODE_SUCCESS; }
|
||||||
if (mgmtCheckUserLimitFp) {
|
|
||||||
return (*mgmtCheckUserLimitFp)(pAcct);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mgmtCheckDbLimit(SAcctObj *pAcct) {
|
int32_t mgmtCheckDbLimit(SAcctObj *pAcct) { return TSDB_CODE_SUCCESS; }
|
||||||
if (mgmtCheckDbLimitFp) {
|
|
||||||
return (*mgmtCheckDbLimitFp)(pAcct);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mgmtCheckTableLimit(SAcctObj *pAcct, int32_t numOfTimeSeries) {
|
int32_t mgmtCheckTableLimit(SAcctObj *pAcct) { return TSDB_CODE_SUCCESS; }
|
||||||
if (mgmtCheckTableLimitFp) {
|
|
||||||
return (*mgmtCheckTableLimitFp)(pAcct, numOfTimeSeries);
|
#endif
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue