more TDB
This commit is contained in:
parent
727db57799
commit
f1e2ca5074
|
@ -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;
|
||||
};
|
||||
#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;
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue