提交 fa72df13 编写于 作者: H Hongze Cheng

more TDB

上级 0a372a73
......@@ -16,11 +16,14 @@
#include "tdbInt.h"
struct SBtCursor {
// TODO
SBTree *pBtree;
pgno_t pgno;
SPage * pPage; // current page traversing
};
static int btreeCreate(SBTree **pBt);
static int btreeDestroy(SBTree *pBt);
static int btreeCursorMoveToChild(SBtCursor *pBtCur, pgno_t pgno);
int btreeOpen(SBTree **ppBt, SPgFile *pPgFile) {
SBTree *pBt;
......@@ -48,4 +51,41 @@ static int btreeCreate(SBTree **pBt) {
static int btreeDestroy(SBTree *pBt) {
// TODO
return 0;
}
int btreeCursorOpen(SBtCursor *pBtCur, SBTree *pBt) {
// TODO
return 0;
}
int btreeCursorClose(SBtCursor *pBtCur) {
// TODO
return 0;
}
int btreeCursorMoveTo(SBtCursor *pBtCur) {
SPage *pPage;
pgno_t childPgno;
// 1. Move the cursor to the root page
// 2. Loop to search over the whole tree
for (;;) {
pPage = pBtCur->pPage;
// Loop to search in current page
for (;;) {
/* code */
}
btreeCursorMoveToChild(pBtCur, childPgno);
}
return 0;
}
static int btreeCursorMoveToChild(SBtCursor *pBtCur, pgno_t pgno) {
SPgFile *pPgFile;
// TODO
return 0;
}
\ No newline at end of file
......@@ -49,4 +49,9 @@ int tdbCheckFileAccess(const char *pathname, int mode) {
}
return access(pathname, flags);
}
int64_t tdbGetFileSize(const char *fname) {
// TODO
return 0;
}
\ No newline at end of file
......@@ -29,6 +29,8 @@ int tdbGnrtFileID(const char *fname, uint8_t *fileid, bool unique);
#define TDB_W_OK 0x4
int tdbCheckFileAccess(const char *pathname, int mode);
int64_t tdbGetFileSize(const char *fname);
#ifdef __cplusplus
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册