This commit is contained in:
Hongze Cheng 2022-02-28 06:13:13 +00:00
parent 596c193376
commit 50a8637464
3 changed files with 11 additions and 1 deletions

View File

@ -63,7 +63,7 @@ static int tdbBtCursorMoveToRoot(SBtCursor *pCur);
static int tdbInitBtPage(SPage *pPage, SBtPage **ppBtPage);
static int tdbCompareKeyAndCell(const void *pKey, int kLen, const void *pCell);
int tdbBtreeOpen(SPgno root, SBTree **ppBt) {
int tdbBtreeOpen(SBTree **ppBt) {
*ppBt = NULL;
/* TODO */
return 0;

View File

@ -23,6 +23,7 @@ struct STDb {
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb) {
STDb * pDb;
SPFile *pFile;
int ret;
*ppDb = NULL;
@ -31,8 +32,15 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF
return -1;
}
// pDb->pEnv
pDb->pEnv = pEnv;
// pDb->pBt
ret = tdbBtreeOpen(&(pDb->pBt));
if (ret < 0) {
return -1;
}
*ppDb = pDb;
return 0;
}

View File

@ -23,6 +23,8 @@ extern "C" {
typedef struct SBTree SBTree;
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);
#ifdef __cplusplus