more
This commit is contained in:
parent
1d622b5a97
commit
8284bf65d5
|
@ -28,6 +28,7 @@ struct SPFile {
|
|||
int nDirty;
|
||||
SPage * pDirty;
|
||||
SPage * pDirtyTail;
|
||||
u8 inTran;
|
||||
};
|
||||
|
||||
static int tdbPFileReadPage(SPFile *pFile, SPage *pPage);
|
||||
|
@ -119,8 +120,23 @@ SPage *tdbPFileGet(SPFile *pFile, SPgno pgno) {
|
|||
}
|
||||
|
||||
int tdbPFileWrite(SPFile *pFile, SPage *pPage) {
|
||||
// TODO: if the page is not in journal, write to journal
|
||||
// mark the page as dirty
|
||||
int ret;
|
||||
|
||||
if (pFile->inTran == 0) {
|
||||
ret = tdbPFileBegin(pFile);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pFile->inTran;
|
||||
}
|
||||
|
||||
if (pPage->isDirty == 0) {
|
||||
pPage->isDirty = 1;
|
||||
// TODO: add the page to the dirty list
|
||||
|
||||
// TODO: write the page to the journal
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -143,7 +159,10 @@ int tdbPFileAllocPage(SPFile *pFile, SPage **ppPage, SPgno *ppgno) {
|
|||
}
|
||||
|
||||
int tdbPFileBegin(SPFile *pFile) {
|
||||
// TODO
|
||||
if (pFile->inTran) {
|
||||
return 0;
|
||||
}
|
||||
/* TODO */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ struct SPage {
|
|||
u8 isAnchor;
|
||||
u8 isLocalPage;
|
||||
u8 isLoad;
|
||||
u8 isDirty;
|
||||
i32 nRef;
|
||||
SPCache *pCache;
|
||||
SPage * pFreeNext;
|
||||
|
|
Loading…
Reference in New Issue