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

more TDB

上级 5c1cad5a
...@@ -131,10 +131,18 @@ int tdbEnvCommit(TENV *pEnv) { ...@@ -131,10 +131,18 @@ int tdbEnvCommit(TENV *pEnv) {
const char *tdbEnvGetRootDir(TENV *pEnv) { return pEnv->rootDir; } const char *tdbEnvGetRootDir(TENV *pEnv) { return pEnv->rootDir; }
#define TDB_ENV_PGF_HASH(fileid) \
({ \
uint8_t *tmp = (uint8_t *)(fileid); \
tmp[0] + tmp[1] + tmp[2]; \
})
int tdbEnvRgstPageFile(TENV *pEnv, SPgFile *pPgFile) { int tdbEnvRgstPageFile(TENV *pEnv, SPgFile *pPgFile) {
SPgFileList *pBucket; SPgFileList *pBucket;
pBucket = pEnv->pgfht.buckets + (0 % TDB_ENV_PGF_HASH_BUCKETS); // TODO TD_DLIST_APPEND_WITH_FIELD(&(pEnv->pgfList), pPgFile, envPgfList);
pBucket = pEnv->pgfht.buckets + (TDB_ENV_PGF_HASH(pPgFile->fileid) % TDB_ENV_PGF_HASH_BUCKETS); // TODO
TD_DLIST_APPEND_WITH_FIELD(pBucket, pPgFile, envHash); TD_DLIST_APPEND_WITH_FIELD(pBucket, pPgFile, envHash);
return 0; return 0;
......
...@@ -38,6 +38,7 @@ struct SPgFile { ...@@ -38,6 +38,7 @@ struct SPgFile {
uint8_t fileid[TDB_FILE_ID_LEN]; // file id uint8_t fileid[TDB_FILE_ID_LEN]; // file id
int fd; int fd;
SPgFileListNode envHash; SPgFileListNode envHash;
SPgFileListNode envPgfList;
// TDB * pDb; // For a SPgFile for multiple databases, this is the <dbname, pgno> mapping DB. // TDB * pDb; // For a SPgFile for multiple databases, this is the <dbname, pgno> mapping DB.
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册