提交 f1e2ca50 编写于 作者: H Hongze Cheng

more TDB

上级 727db577
......@@ -133,12 +133,30 @@ static int tdbEnvDestroy(TENV *pEnv) {
}
int tdbEnvBeginTxn(TENV *pEnv) {
// TODO
SJournal *pJournal;
int ret;
ASSERT(pEnv->pJournal == NULL);
pJournal = (SJournal *)(&(pEnv[1]));
ret = tdbOpenJournal(pJournal);
if (ret < 0) {
// TODO: handle error
return -1;
}
pEnv->pJournal = pJournal;
return 0;
}
int tdbEnvCommit(TENV *pEnv) {
// TODO
SJournal *pJournal;
ASSERT(pEnv->pJournal != NULL);
pJournal = pEnv->pJournal;
tdbCloseJournal(pJournal);
/* TODO */
return 0;
}
......
......@@ -13,7 +13,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
struct SJournal {
char *jname;
int fd;
};
\ No newline at end of file
#include "tdbInt.h"
int tdbOpenJournal(SJournal *pJournal) {
// pJournal->fd = open();
if (pJournal->fd < 0) {
// TODO: handle error
return -1;
}
return 0;
}
int tdbCloseJournal(SJournal *pJournal) {
// TODO
return 0;
}
\ No newline at end of file
......@@ -21,6 +21,13 @@ extern "C" {
#endif
typedef struct SJournal SJournal;
struct SJournal {
char jname[64];
int fd;
};
int tdbOpenJournal(SJournal *pJournal);
int tdbCloseJournal(SJournal *pJournal);
#ifdef __cplusplus
}
......
......@@ -37,9 +37,10 @@ struct SPgFile {
char * fname; // backend file name
uint8_t fileid[TDB_FILE_ID_LEN]; // file id
int fd;
pgno_t dbSize;
pgno_t dbNewSize;
SPgFileListNode envHash;
SPgFileListNode envPgfList;
// TDB * pDb; // For a SPgFile for multiple databases, this is the <dbname, pgno> mapping DB.
};
int pgFileOpen(SPgFile **ppPgFile, const char *fname, TENV *pEnv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册