more TDB
This commit is contained in:
parent
0a372a7359
commit
fa72df133e
|
@ -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;
|
||||
}
|
|
@ -49,4 +49,9 @@ int tdbCheckFileAccess(const char *pathname, int mode) {
|
|||
}
|
||||
|
||||
return access(pathname, flags);
|
||||
}
|
||||
|
||||
int64_t tdbGetFileSize(const char *fname) {
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue