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

more TDB

上级 7c939b92
...@@ -63,8 +63,15 @@ int tdbEnvOpen(TENV *pEnv) { ...@@ -63,8 +63,15 @@ int tdbEnvOpen(TENV *pEnv) {
ASSERT(pEnv != NULL); ASSERT(pEnv != NULL);
TERR_A(ret, pgCacheCreate(&pPgCache, pEnv->pgSize, pEnv->cacheSize / pEnv->pgSize), _err); /* TODO: here we do not need to create the root directory, more
TERR_A(ret, pgCacheOpen(&pPgCache), _err); * work should be done here
*/
mkdir(pEnv->rootDir, 0755);
ret = pgCacheCreate(&pPgCache, pEnv->pgSize, pEnv->cacheSize / pEnv->pgSize);
if (ret != 0) {
goto _err;
}
pEnv->pPgCache = pPgCache; pEnv->pPgCache = pPgCache;
......
...@@ -88,21 +88,6 @@ int pgCacheDestroy(SPgCache *pPgCache) { ...@@ -88,21 +88,6 @@ int pgCacheDestroy(SPgCache *pPgCache) {
return 0; return 0;
} }
int pgCacheOpen(SPgCache **ppPgCache) {
if (*ppPgCache == NULL) {
if (pgCacheCreate(ppPgCache, TDB_DEFAULT_PGSIZE, TDB_DEFAULT_CACHE_SIZE / TDB_DEFAULT_PGSIZE) < 0) {
return -1;
}
}
// TODO
return 0;
}
int pgCacheClose(SPgCache *pPgCache) {
// TODO
return 0;
}
#define PG_CACHE_HASH(fileid, pgno) \ #define PG_CACHE_HASH(fileid, pgno) \
({ \ ({ \
uint64_t *tmp = (uint64_t *)(fileid); \ uint64_t *tmp = (uint64_t *)(fileid); \
......
...@@ -26,8 +26,6 @@ typedef struct SPage SPage; ...@@ -26,8 +26,6 @@ typedef struct SPage SPage;
// SPgCache // SPgCache
int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage); int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage);
int pgCacheDestroy(SPgCache *pPgCache); int pgCacheDestroy(SPgCache *pPgCache);
int pgCacheOpen(SPgCache **ppPgCache);
int pgCacheClose(SPgCache *pPgCache);
SPage *pgCacheFetch(SPgCache *pPgCache, pgid_t pgid); SPage *pgCacheFetch(SPgCache *pPgCache, pgid_t pgid);
int pgCacheRelease(SPage *pPage); int pgCacheRelease(SPage *pPage);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册