提交 9961bf33 编写于 作者: S slguan

[TD-16] change account codes

上级 7c89da98
......@@ -14,87 +14,13 @@
*/
#define _DEFAULT_SOURCE
#ifndef _ACCOUNT
#include "os.h"
#include "mnode.h"
#include "mgmtAcct.h"
static SAcctObj tsAcctObj = {0};
int32_t mgmtAddDbIntoAcct(SAcctObj *pAcct, SDbObj *pDb) {
pthread_mutex_lock(&pAcct->mutex);
pDb->next = pAcct->pHead;
pDb->prev = NULL;
if (pAcct->pHead) {
pAcct->pHead->prev = pDb;
}
pAcct->pHead = pDb;
pAcct->acctInfo.numOfDbs++;
pthread_mutex_unlock(&pAcct->mutex);
return 0;
}
int32_t mgmtRemoveDbFromAcct(SAcctObj *pAcct, SDbObj *pDb) {
pthread_mutex_lock(&pAcct->mutex);
if (pDb->prev) {
pDb->prev->next = pDb->next;
}
if (pDb->next) {
pDb->next->prev = pDb->prev;
}
if (pDb->prev == NULL) {
pAcct->pHead = pDb->next;
}
pAcct->acctInfo.numOfDbs--;
pthread_mutex_unlock(&pAcct->mutex);
return 0;
}
int32_t mgmtAddUserIntoAcct(SAcctObj *pAcct, SUserObj *pUser) {
pthread_mutex_lock(&pAcct->mutex);
pUser->next = pAcct->pUser;
pUser->prev = NULL;
if (pAcct->pUser) {
pAcct->pUser->prev = pUser;
}
pAcct->pUser = pUser;
pAcct->acctInfo.numOfUsers++;
pUser->pAcct = pAcct;
pthread_mutex_unlock(&pAcct->mutex);
return 0;
}
int32_t mgmtRemoveUserFromAcct(SAcctObj *pAcct, SUserObj *pUser) {
pthread_mutex_lock(&pAcct->mutex);
if (pUser->prev) {
pUser->prev->next = pUser->next;
}
if (pUser->next) {
pUser->next->prev = pUser->prev;
}
if (pUser->prev == NULL) {
pAcct->pUser = pUser->next;
}
pAcct->acctInfo.numOfUsers--;
pthread_mutex_unlock(&pAcct->mutex);
return 0;
}
#ifndef _ACCOUNT
int32_t mgmtInitAccts() {
tsAcctObj.acctId = 0;
strcpy(tsAcctObj.user, "root");
......@@ -105,6 +31,14 @@ SAcctObj *mgmtGetAcct(char *acctName) { return &tsAcctObj; }
void mgmtCleanUpAccts() {}
int32_t mgmtAddDbIntoAcct(SAcctObj *pAcct, SDbObj *pDb) { return TSDB_CODE_SUCCESS; }
int32_t mgmtRemoveDbFromAcct(SAcctObj *pAcct, SDbObj *pDb) { return TSDB_CODE_SUCCESS; }
int32_t mgmtAddUserIntoAcct(SAcctObj *pAcct, SUserObj *pUser) { return TSDB_CODE_SUCCESS; }
int32_t mgmtRemoveUserFromAcct(SAcctObj *pAcct, SUserObj *pUser) { return TSDB_CODE_SUCCESS; }
int32_t mgmtCheckUserLimit(SAcctObj *pAcct) { return TSDB_CODE_SUCCESS; }
int32_t mgmtCheckDbLimit(SAcctObj *pAcct) { return TSDB_CODE_SUCCESS; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册