提交 933fbaff 编写于 作者: H Hongze Cheng

more TDB

上级 cc893cf9
......@@ -68,7 +68,7 @@ int tdbEnvOpen(TENV *pEnv) {
*/
mkdir(pEnv->rootDir, 0755);
ret = pgCacheCreate(&pPgCache, pEnv->pgSize, pEnv->cacheSize / pEnv->pgSize);
ret = pgCacheOpen(&pPgCache, pEnv->pgSize, pEnv->cacheSize / pEnv->pgSize);
if (ret != 0) {
goto _err;
}
......
......@@ -17,7 +17,7 @@
static void pgCachePinPage(SPage *pPage);
static void pgCacheUnpinPage(SPage *pPage);
int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage) {
int pgCacheOpen(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage) {
SPgCache *pPgCache;
SPage * pPage;
......@@ -38,7 +38,7 @@ int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage) {
pPgCache->pages = (SPage *)calloc(npage, sizeof(SPage));
if (pPgCache->pages == NULL) {
pgCacheDestroy(pPgCache);
pgCacheClose(pPgCache);
return -1;
}
......@@ -52,14 +52,14 @@ int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage) {
pPage->pData = (uint8_t *)calloc(1, pgSize);
if (pPage->pData == NULL) {
pgCacheDestroy(pPgCache);
pgCacheClose(pPgCache);
return -1;
}
pPgCache->pght.nbucket = npage;
pPgCache->pght.buckets = (SPgList *)calloc(pPgCache->pght.nbucket, sizeof(SPgList));
if (pPgCache->pght.buckets == NULL) {
pgCacheDestroy(pPgCache);
pgCacheClose(pPgCache);
return -1;
}
......@@ -70,7 +70,7 @@ int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage) {
return 0;
}
int pgCacheDestroy(SPgCache *pPgCache) {
int pgCacheClose(SPgCache *pPgCache) {
SPage *pPage;
if (pPgCache) {
tfree(pPgCache->pght.buckets);
......
......@@ -24,8 +24,8 @@ typedef struct SPgCache SPgCache;
typedef struct SPage SPage;
// SPgCache
int pgCacheCreate(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage);
int pgCacheDestroy(SPgCache *pPgCache);
int pgCacheOpen(SPgCache **ppPgCache, pgsz_t pgSize, int32_t npage);
int pgCacheClose(SPgCache *pPgCache);
SPage *pgCacheFetch(SPgCache *pPgCache, pgid_t pgid);
int pgCacheRelease(SPage *pPage);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册