提交 50a86374 编写于 作者: H Hongze Cheng

more

上级 596c1933
...@@ -63,7 +63,7 @@ static int tdbBtCursorMoveToRoot(SBtCursor *pCur); ...@@ -63,7 +63,7 @@ static int tdbBtCursorMoveToRoot(SBtCursor *pCur);
static int tdbInitBtPage(SPage *pPage, SBtPage **ppBtPage); static int tdbInitBtPage(SPage *pPage, SBtPage **ppBtPage);
static int tdbCompareKeyAndCell(const void *pKey, int kLen, const void *pCell); static int tdbCompareKeyAndCell(const void *pKey, int kLen, const void *pCell);
int tdbBtreeOpen(SPgno root, SBTree **ppBt) { int tdbBtreeOpen(SBTree **ppBt) {
*ppBt = NULL; *ppBt = NULL;
/* TODO */ /* TODO */
return 0; return 0;
......
...@@ -23,6 +23,7 @@ struct STDb { ...@@ -23,6 +23,7 @@ struct STDb {
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb) { int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb) {
STDb * pDb; STDb * pDb;
SPFile *pFile; SPFile *pFile;
int ret;
*ppDb = NULL; *ppDb = NULL;
...@@ -31,8 +32,15 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF ...@@ -31,8 +32,15 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF
return -1; return -1;
} }
// pDb->pEnv
pDb->pEnv = pEnv; pDb->pEnv = pEnv;
// pDb->pBt
ret = tdbBtreeOpen(&(pDb->pBt));
if (ret < 0) {
return -1;
}
*ppDb = pDb; *ppDb = pDb;
return 0; return 0;
} }
......
...@@ -23,6 +23,8 @@ extern "C" { ...@@ -23,6 +23,8 @@ extern "C" {
typedef struct SBTree SBTree; typedef struct SBTree SBTree;
typedef struct SBtCursor SBtCursor; typedef struct SBtCursor SBtCursor;
int tdbBtreeOpen(SBTree **ppBt);
int tdbBtreeClose(SBTree *pBt);
int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *pVal, int vLen); int tdbBtCursorInsert(SBtCursor *pCur, const void *pKey, int kLen, const void *pVal, int vLen);
#ifdef __cplusplus #ifdef __cplusplus
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册