more TDB
This commit is contained in:
parent
a10e0649a0
commit
49edc62e6d
|
@ -26,6 +26,14 @@ typedef struct {
|
|||
pgsz_t offset;
|
||||
} SBtIdx;
|
||||
|
||||
// Btree page header definition
|
||||
typedef struct {
|
||||
uint8_t flags;
|
||||
uint16_t ncells;
|
||||
pgsz_t pldOffset; // payload offset
|
||||
/* TODO */
|
||||
} SBtPgHdr;
|
||||
|
||||
static int btreeCreate(SBTree **pBt);
|
||||
static int btreeDestroy(SBTree *pBt);
|
||||
static int btreeCursorMoveToChild(SBtCursor *pBtCur, pgno_t pgno);
|
||||
|
@ -69,9 +77,10 @@ int btreeCursorClose(SBtCursor *pBtCur) {
|
|||
}
|
||||
|
||||
int btreeCursorMoveTo(SBtCursor *pBtCur, int kLen, const void *pKey) {
|
||||
SPage *pPage;
|
||||
pgno_t childPgno;
|
||||
int idx;
|
||||
SPage * pPage;
|
||||
SBtPgHdr *pBtPgHdr;
|
||||
pgno_t childPgno;
|
||||
int idx;
|
||||
|
||||
// 1. Move the cursor to the root page
|
||||
|
||||
|
|
|
@ -20,6 +20,18 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
char hdrInfo[16]; // info string
|
||||
pgsz_t szPage; // page size of current file
|
||||
int32_t cno; // commit number counter
|
||||
pgno_t freePgno; // freelist page number
|
||||
uint8_t resv[100]; // reserved space
|
||||
} SPgFileHdr;
|
||||
|
||||
#define TDB_PG_FILE_HDR_SIZE 128
|
||||
|
||||
TD_STATIC_ASSERT(sizeof(SPgFileHdr) == TDB_PG_FILE_HDR_SIZE, "Page file header size if not 128");
|
||||
|
||||
struct SPgFile {
|
||||
char * fname; // backend file name
|
||||
uint8_t fileid[TDB_FILE_ID_LEN]; // file id
|
||||
|
|
|
@ -93,12 +93,16 @@ typedef TD_DLIST(SPgFile) SPgFileList;
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#include "btree.h"
|
||||
#include "pgcache.h"
|
||||
#include "pgfile.h"
|
||||
#include "tdbEnv.h"
|
||||
#include "tdbUtil.h"
|
||||
|
||||
#include "btree.h"
|
||||
|
||||
#include "pgcache.h"
|
||||
|
||||
#include "pgfile.h"
|
||||
|
||||
#include "tdbEnv.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
#define TD_STATIC_ASSERT(op, info) static_assert(op, info)
|
||||
#else
|
||||
#define TD_STATIC_ASSERT(op, info)
|
||||
#endif
|
||||
|
||||
#define TDB_ROUND8(x) (((x) + 7) & ~7)
|
||||
|
||||
int tdbGnrtFileID(const char *fname, uint8_t *fileid, bool unique);
|
||||
|
|
Loading…
Reference in New Issue