feat: support uniq grant

This commit is contained in:
kailixu 2024-01-31 09:47:10 +08:00
parent 93c0890f68
commit a11410378f
2 changed files with 10 additions and 10 deletions

View File

@ -756,7 +756,7 @@ typedef struct {
SArray* compactDetail; SArray* compactDetail;
} SCompactObj; } SCompactObj;
// SGrantObj // SGrantLogObj
typedef enum { typedef enum {
GRANT_STATE_INIT = 0, GRANT_STATE_INIT = 0,
GRANT_STATE_UNGRANTED = 1, GRANT_STATE_UNGRANTED = 1,
@ -826,7 +826,7 @@ typedef struct {
char* active; char* active;
SArray* pMachines; // SGrantMachine SArray* pMachines; // SGrantMachine
SRWLatch lock; SRWLatch lock;
} SGrantObj; } SGrantLogObj;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -30,21 +30,21 @@
void grantRestore(EGrantType grant, uint64_t value); void grantRestore(EGrantType grant, uint64_t value);
#ifdef TD_ENTERPRISE #ifdef TD_ENTERPRISE
SSdbRaw *mndGrantActionEncode(SGrantObj * pGrant); SSdbRaw *mndGrantActionEncode(SGrantLogObj * pGrant);
SSdbRow *mndGrantActionDecode(SSdbRaw * pRaw); SSdbRow *mndGrantActionDecode(SSdbRaw * pRaw);
int32_t mndGrantActionInsert(SSdb * pSdb, SGrantObj * pGrant); int32_t mndGrantActionInsert(SSdb * pSdb, SGrantLogObj * pGrant);
int32_t mndGrantActionDelete(SSdb * pSdb, SGrantObj * pGrant); int32_t mndGrantActionDelete(SSdb * pSdb, SGrantLogObj * pGrant);
int32_t mndGrantActionUpdate(SSdb * pSdb, SGrantObj * pOldGrant, SGrantObj * pNewGrant); int32_t mndGrantActionUpdate(SSdb * pSdb, SGrantLogObj * pOldGrant, SGrantLogObj * pNewGrant);
int32_t grantAlterActiveCode(SMnode * pMnode, SGrantObj * pObj, const char *oldActive, const char *newActive, int32_t grantAlterActiveCode(SMnode * pMnode, SGrantLogObj * pObj, const char *oldActive, const char *newActive,
char **mergeActive); char **mergeActive);
int32_t mndProcessConfigGrantReq(SMnode * pMnode, SRpcMsg * pReq, SMCfgClusterReq * pCfg); int32_t mndProcessConfigGrantReq(SMnode * pMnode, SRpcMsg * pReq, SMCfgClusterReq * pCfg);
int32_t mndProcessUpdGrantLog(SMnode * pMnode, SRpcMsg * pReq, SArray * pMachines, SGrantState * pState); int32_t mndProcessUpdGrantLog(SMnode * pMnode, SRpcMsg * pReq, SArray * pMachines, SGrantState * pState);
int32_t mndGrantGetLastState(SMnode * pMnode, SGrantState * pState); int32_t mndGrantGetLastState(SMnode * pMnode, SGrantState * pState);
SGrantObj *mndAcquireGrant(SMnode * pMnode, void **ppIter); SGrantLogObj *mndAcquireGrant(SMnode * pMnode, void **ppIter);
void mndReleaseGrant(SMnode * pMnode, SGrantObj * pGrant, void *pIter); void mndReleaseGrant(SMnode * pMnode, SGrantLogObj * pGrant, void *pIter);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus