more TDB
This commit is contained in:
parent
7c939b929c
commit
cc893cf96d
|
@ -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) {
|
||||||
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;
|
||||||
// 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);
|
||||||
|
|
Loading…
Reference in New Issue