From 2586ac0b03d8898d7b73d0eca7f33df1e0959c5f Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 28 Feb 2022 10:30:23 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/src/db/tdbPFile.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPFile.c b/source/libs/tdb/src/db/tdbPFile.c index 80738e5b39..5ddf5d6629 100644 --- a/source/libs/tdb/src/db/tdbPFile.c +++ b/source/libs/tdb/src/db/tdbPFile.c @@ -127,8 +127,6 @@ int tdbPFileWrite(SPFile *pFile, SPage *pPage) { if (ret < 0) { return -1; } - - pFile->inTran; } if (pPage->isDirty == 0) { @@ -136,6 +134,8 @@ int tdbPFileWrite(SPFile *pFile, SPage *pPage) { // TODO: add the page to the dirty list // TODO: write the page to the journal + if (1 /*actually load from the file*/) { + } } return 0; } @@ -162,7 +162,17 @@ int tdbPFileBegin(SPFile *pFile) { if (pFile->inTran) { return 0; } - /* TODO */ + + // Open the journal + pFile->jfd = open(pFile->jFileName, O_RDWR | O_CREAT, 0755); + if (pFile->jfd < 0) { + return -1; + } + + // TODO: write the size of the file + + pFile->inTran = 1; + return 0; }