提交 79cdb9c2 编写于 作者: H Hongze Cheng

more TDB

上级 df0ab85f
......@@ -10,6 +10,9 @@ target_sources(tdb
"src/db/tdbPCache.c"
"src/db/tdbPFile.c"
"src/db/tdbUtil.c"
"src/db/tdbBtree.c"
"src/db/tdb.c"
"src/db/tdbEnv.c"
)
target_include_directories(
......
......@@ -15,6 +15,7 @@
#include "tdbInt.h"
#if 0
struct STDb {
char dbname[TDB_MAX_DBNAME_LEN];
SBTree * pBt; // current access method (may extend)
......@@ -202,4 +203,5 @@ static int tdbDefaultKeyCmprFn(int keyLen1, const void *pKey1, int keyLen2, cons
}
}
return cret;
}
\ No newline at end of file
}
#endif
\ No newline at end of file
......@@ -17,10 +17,51 @@
struct STEnv {
char * rootDir;
SPCache *pCache;
int jfd;
SPCache *pCache;
};
int tdbEnvOpen(const char *rootDir, STEnv **ppEnv) {
STEnv * pEnv;
int dsize;
int zsize;
uint8_t *pPtr;
*ppEnv = NULL;
dsize = strlen(rootDir);
zsize = sizeof(*pEnv) + dsize + 1;
pPtr = (uint8_t *)calloc(1, zsize);
if (pPtr == NULL) {
return -1;
}
pEnv = (STEnv *)pPtr;
pPtr += sizeof(*pEnv);
pEnv->rootDir = pPtr;
memcpy(pEnv->rootDir, rootDir, dsize);
pEnv->rootDir[dsize] = '\0';
*ppEnv = pEnv;
return 0;
}
int tdbEnvClose(STEnv *pEnv) {
// TODO
return 0;
}
int tdbEnvBegin(STEnv *pEnv) {
// TODO
return 0;
}
int tdbEnvCommit(STEnv *pEnv) {
// TODO
return 0;
}
#if 0
struct STDbEnv {
char * rootDir; // root directory of the environment
......
......@@ -22,7 +22,7 @@ extern "C" {
typedef struct STEnv STEnv;
int tdbEnvOpen(STEnv **ppEnv);
int tdbEnvOpen(const char *rootDir, STEnv **ppEnv);
int tdbEnvClose(STEnv *pEnv);
int tdbEnvBegin(STEnv *pEnv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册