提交 4ac1fca0 编写于 作者: H Hongze Cheng

more TDB

上级 c908f178
......@@ -294,10 +294,10 @@ static int tdbBtreeOpenImpl(SBTree *pBt) {
}
// Try to create a new database
ret = tdbPagerNewPage(pBt->pPager, &pgno, &pPage);
if (ret < 0) {
return -1;
}
// ret = tdbPagerNewPage(pBt->pPager, &pgno, &pPage);
// if (ret < 0) {
// return -1;
// }
ASSERT(pgno != 0);
pBt->root = pgno;
......
......@@ -227,7 +227,7 @@ static int tdbPagerReadPage(SPager *pPager, SPage *pPage) {
int tdbPagerGetPageSize(SPager *pPager) { return pPager->pageSize; }
int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) {
int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg) {
SPage *pPage;
SPgid pgid;
int ret;
......@@ -251,10 +251,10 @@ int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) {
return -1;
}
// ret = (*initPage)(pPage);
// if (ret < 0) {
// return -1;
// }
ret = (*initPage)(pPage, arg);
if (ret < 0) {
return -1;
}
pPage->pPager = pPager;
}
......@@ -268,7 +268,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage) {
return 0;
}
int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage) {
int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg) {
int ret;
SPage *pPage;
SPgid pgid;
......@@ -296,7 +296,7 @@ int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage) {
// tdbWLockPage(pPage);
// TODO: zero init the new page
// (*initNewPage)(pPage, arg);
(*initPage)(pPage, arg);
pPage->pPager = NULL;
......
......@@ -28,8 +28,8 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage);
int tdbPagerBegin(SPager *pPager);
int tdbPagerCommit(SPager *pPager);
int tdbPagerGetPageSize(SPager *pPager);
int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage);
int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage);
int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg);
int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg);
#ifdef __cplusplus
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册