refact vnode
This commit is contained in:
parent
e582931cff
commit
e048acfe76
|
@ -10,7 +10,7 @@ target_sources(
|
|||
"src/vnd/vnodeCfg.c"
|
||||
"src/vnd/vnodeCommit.c"
|
||||
"src/vnd/vnodeInt.c"
|
||||
"src/vnd/vnodeMain.c"
|
||||
"src/vnd/vnodeOpen.c"
|
||||
"src/vnd/vnodeQuery.c"
|
||||
"src/vnd/vnodeStateMgr.c"
|
||||
"src/vnd/vnodeWrite.c"
|
||||
|
|
|
@ -44,9 +44,10 @@ typedef struct SVnodeCfg SVnodeCfg;
|
|||
|
||||
int vnodeInit();
|
||||
void vnodeCleanup();
|
||||
int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs);
|
||||
void vnodeDestroy(const char *path);
|
||||
SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg);
|
||||
void vnodeClose(SVnode *pVnode);
|
||||
void vnodeDestroy(const char *path);
|
||||
void vnodePreprocessWriteReqs(SVnode *pVnode, SArray *pMsgs);
|
||||
int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
|
||||
int vnodeProcessCMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
|
||||
|
|
|
@ -20,6 +20,29 @@ static void vnodeFree(SVnode *pVnode);
|
|||
static int vnodeOpenImpl(SVnode *pVnode);
|
||||
static void vnodeCloseImpl(SVnode *pVnode);
|
||||
|
||||
int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
|
||||
#if 0
|
||||
char dir[TSDB_FILENAME_LEN];
|
||||
// TODO: check if directory exists
|
||||
|
||||
// check config
|
||||
if (vnodeCheckCfg(pCfg) < 0) {
|
||||
vError("vgId: %d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
// create vnode env
|
||||
tfsMkdir(pTfs, path);
|
||||
snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path);
|
||||
if (vnodeSaveCfg(dir, pCfg) < 0) {
|
||||
vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) {
|
||||
SVnode *pVnode = NULL;
|
||||
|
Loading…
Reference in New Issue