提交 4b5f00ca 编写于 作者: H Hongze Cheng

more TDB

上级 6e995780
......@@ -15,6 +15,15 @@
#include "tdbInt.h"
typedef struct SPage1 {
char magic[64];
pgno_t mdbRootPgno; // master DB root page number
pgno_t freePgno; // free list page number
uint32_t nFree; // number of free pages
} SPage1;
TDB_STATIC_ASSERT(sizeof(SPage1) <= TDB_MIN_PGSIZE, "TDB Page1 definition too large");
static int pgFileRead(SPgFile *pPgFile, pgno_t pgno, uint8_t *pData);
int pgFileOpen(SPgFile **ppPgFile, const char *fname, TENV *pEnv) {
......@@ -116,7 +125,7 @@ int pgFileAllocatePage(SPgFile *pPgFile, pgno_t *pPgno) {
if (0) {
// TODO: allocate from the free list
} else {
pgno = ++pPgFile->dbNewSize;
pgno = ++(pPgFile->lsize);
}
*pPgno = pgno;
......
......@@ -36,9 +36,9 @@ struct SPgFile {
TENV * pEnv; // env containing this page file
char * fname; // backend file name
uint8_t fileid[TDB_FILE_ID_LEN]; // file id
pgno_t lsize; // page file logical size (for count)
pgno_t fsize; // real file size on disk (for rollback)
int fd;
pgno_t dbSize;
pgno_t dbNewSize;
SPgFileListNode envHash;
SPgFileListNode envPgfList;
};
......@@ -46,7 +46,6 @@ struct SPgFile {
int pgFileOpen(SPgFile **ppPgFile, const char *fname, TENV *pEnv);
int pgFileClose(SPgFile *pPgFile);
SPage *pgFileFetch(SPgFile *pPgFile, pgno_t pgno);
int pgFileRelease(SPage *pPage);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册