This commit is contained in:
Hongze Cheng 2022-02-23 08:40:54 +00:00
parent 932a77b5f8
commit 9842da7909
6 changed files with 9 additions and 7 deletions

View File

@ -9,6 +9,7 @@ target_sources(tdb
PRIVATE PRIVATE
"src/db/tdbPCache.c" "src/db/tdbPCache.c"
"src/db/tdbPFile.c" "src/db/tdbPFile.c"
"src/db/tdbUtil.c"
) )
target_include_directories( target_include_directories(

View File

@ -15,6 +15,7 @@
#include "tdbInt.h" #include "tdbInt.h"
#if 0
struct STDbEnv { struct STDbEnv {
char * rootDir; // root directory of the environment char * rootDir; // root directory of the environment
char * jname; // journal file name char * jname; // journal file name
@ -170,4 +171,5 @@ int tdbEnvRgstPageFile(TENV *pEnv, SPgFile *pPgFile) {
int tdbEnvRgstDB(TENV *pEnv, TDB *pDb) { int tdbEnvRgstDB(TENV *pEnv, TDB *pDb) {
// TODO // TODO
return 0; return 0;
} }
#endif

View File

@ -51,7 +51,7 @@ int tdbCheckFileAccess(const char *pathname, int mode) {
return access(pathname, flags); return access(pathname, flags);
} }
int tdbGetFileSize(const char *fname, pgsz_t pgSize, SPgno *pSize) { int tdbGetFileSize(const char *fname, int pgSize, SPgno *pSize) {
struct stat st; struct stat st;
int ret; int ret;

View File

@ -20,11 +20,13 @@
extern "C" { extern "C" {
#endif #endif
#if 0
const char* tdbEnvGetRootDir(TENV* pEnv); const char* tdbEnvGetRootDir(TENV* pEnv);
SPgFile* tdbEnvGetPageFile(TENV* pEnv, const uint8_t fileid[]); SPgFile* tdbEnvGetPageFile(TENV* pEnv, const uint8_t fileid[]);
SPgCache* tdbEnvGetPgCache(TENV* pEnv); SPgCache* tdbEnvGetPgCache(TENV* pEnv);
int tdbEnvRgstPageFile(TENV* pEnv, SPgFile* pPgFile); int tdbEnvRgstPageFile(TENV* pEnv, SPgFile* pPgFile);
int tdbEnvRgstDB(TENV* pEnv, TDB* pDb); int tdbEnvRgstDB(TENV* pEnv, TDB* pDb);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -19,7 +19,7 @@
#include "tlist.h" #include "tlist.h"
#include "tlockfree.h" #include "tlockfree.h"
#include "tdb.h" // #include "tdb.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -70,9 +70,6 @@ typedef int32_t frame_id_t;
#define TDB_DEFAULT_PGSIZE 4096 #define TDB_DEFAULT_PGSIZE 4096
#define TDB_IS_PGSIZE_VLD(s) (((s) >= TDB_MIN_PGSIZE) && ((s) <= TDB_MAX_PGSIZE)) #define TDB_IS_PGSIZE_VLD(s) (((s) >= TDB_MIN_PGSIZE) && ((s) <= TDB_MAX_PGSIZE))
// pgoff_t
typedef pgsz_t pgoff_t;
// cache // cache
#define TDB_DEFAULT_CACHE_SIZE (256 * 4096) // 1M #define TDB_DEFAULT_CACHE_SIZE (256 * 4096) // 1M

View File

@ -35,7 +35,7 @@ int tdbGnrtFileID(const char *fname, uint8_t *fileid, bool unique);
#define TDB_W_OK 0x4 #define TDB_W_OK 0x4
int tdbCheckFileAccess(const char *pathname, int mode); int tdbCheckFileAccess(const char *pathname, int mode);
int tdbGetFileSize(const char *fname, pgsz_t pgSize, SPgno *pSize); int tdbGetFileSize(const char *fname, int pgSize, SPgno *pSize);
#ifdef __cplusplus #ifdef __cplusplus
} }