提交 87dfa6ce 编写于 作者: H Hongze Cheng

more TDB

上级 10108f34
...@@ -162,13 +162,24 @@ int pgFileWrite(SPage *pPage) { ...@@ -162,13 +162,24 @@ int pgFileWrite(SPage *pPage) {
} }
int pgFileAllocatePage(SPgFile *pPgFile, pgno_t *pPgno) { int pgFileAllocatePage(SPgFile *pPgFile, pgno_t *pPgno) {
pgno_t pgno; pgno_t pgno;
SPage1 * pPage1;
SPgCache *pPgCache;
pgid_t pgid;
SPage * pPage;
if (pPgFile->lsize == 0) { if (pPgFile->lsize == 0) {
pgno = ++(pPgFile->lsize); pgno = ++(pPgFile->lsize);
} else { } else {
if (0) { if (0) {
// TODO: allocate from the free list // TODO: allocate from the free list
pPage = pgCacheFetch(pPgCache, pgid);
if (pPage1->nFree > 0) {
// TODO
} else {
pgno = ++(pPgFile->lsize);
}
} else { } else {
pgno = ++(pPgFile->lsize); pgno = ++(pPgFile->lsize);
} }
......
...@@ -9,7 +9,7 @@ TEST(tdb_test, simple_test) { ...@@ -9,7 +9,7 @@ TEST(tdb_test, simple_test) {
cachesz_t cacheSize = 10240; cachesz_t cacheSize = 10240;
// ENV // ENV
GTEST_ASSERT_EQ(tdbEnvCreate(&pEnv, "./tdbtest"), 0); GTEST_ASSERT_EQ(tdbEnvCreate(&pEnv, "./testtdb"), 0);
GTEST_ASSERT_EQ(tdbEnvSetCache(pEnv, pgSize, cacheSize), 0); GTEST_ASSERT_EQ(tdbEnvSetCache(pEnv, pgSize, cacheSize), 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册