diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index 0f1002c4d1529b83cf00df6c99bc9eb75dc66039..4057bd86e6052d418077f991adea3a13fc208851 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -63,8 +63,15 @@ int tdbEnvOpen(TENV *pEnv) { ASSERT(pEnv != NULL); - TERR_A(ret, pgCacheCreate(&pPgCache, pEnv->pgSize, pEnv->cacheSize / pEnv->pgSize), _err); - TERR_A(ret, pgCacheOpen(&pPgCache), _err); + /* TODO: here we do not need to create the root directory, more + * 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; diff --git a/source/libs/tdb/src/db/tdbPgCache.c b/source/libs/tdb/src/db/tdbPgCache.c index 3d0d770f380810ca18ca663bd7a17d4a3b46bc0f..466a9b2eaf106879d9bf5066b03280ca2df71f54 100644 --- a/source/libs/tdb/src/db/tdbPgCache.c +++ b/source/libs/tdb/src/db/tdbPgCache.c @@ -88,21 +88,6 @@ int pgCacheDestroy(SPgCache *pPgCache) { 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) \ ({ \ uint64_t *tmp = (uint64_t *)(fileid); \ diff --git a/source/libs/tdb/src/inc/tdbPgCache.h b/source/libs/tdb/src/inc/tdbPgCache.h index 4cea86dc6d06cc8fe878ef35eb7c073e31ed5739..de9e254a923a86bad4e4af587e75fa7d5c322964 100644 --- a/source/libs/tdb/src/inc/tdbPgCache.h +++ b/source/libs/tdb/src/inc/tdbPgCache.h @@ -26,8 +26,6 @@ typedef struct SPage SPage; // SPgCache int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage); int pgCacheDestroy(SPgCache *pPgCache); -int pgCacheOpen(SPgCache **ppPgCache); -int pgCacheClose(SPgCache *pPgCache); SPage *pgCacheFetch(SPgCache *pPgCache, pgid_t pgid); int pgCacheRelease(SPage *pPage);