This commit is contained in:
Hongze Cheng 2022-03-09 07:48:45 +00:00
parent c41db68c6a
commit 737497d8b6
3 changed files with 21 additions and 18 deletions

View File

@ -136,11 +136,10 @@ typedef int (*FKeyComparator)(const void *pKey1, int kLen1, const void *pKey2, i
typedef struct SPager SPager;
typedef struct SPCache SPCache;
typedef struct SPage SPage;
#include "tdbUtil.h"
#include "tdbPage.h"
#include "tdbPCache.h"
#include "tdbPager.h"
@ -151,6 +150,8 @@ typedef struct SPCache SPCache;
#include "tdbDb.h"
#include "tdbPage.h"
#ifdef __cplusplus
}
#endif

View File

@ -20,7 +20,18 @@
extern "C" {
#endif
#define TDB_PCACHE_PAGE
#define TDB_PCACHE_PAGE \
u8 isAnchor; \
u8 isLocalPage; \
u8 isDirty; \
i32 nRef; \
SPCache *pCache; \
SPage *pFreeNext; \
SPage *pHashNext; \
SPage *pLruNext; \
SPage *pLruPrev; \
SPage *pDirtyNext; \
SPager *pPager;
int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache);
int tdbPCacheClose(SPCache *pCache);

View File

@ -29,23 +29,14 @@ typedef struct __attribute__((__packed__)) {
SPgno rChild;
} SPageHdr;
typedef struct SPage SPage;
struct SPage {
pthread_spinlock_t lock;
// Fields below used by page cache
void *pData;
SPgid pgid;
u8 isAnchor;
u8 isLocalPage;
u8 isDirty;
i32 nRef;
SPCache *pCache;
SPage *pFreeNext;
SPage *pHashNext;
SPage *pLruNext;
SPage *pLruPrev;
SPage *pDirtyNext;
SPager *pPager;
void *pData;
SPgid pgid;
// Fields used by SPCache
TDB_PCACHE_PAGE
// Fields below used by pager and am
SPageHdr *pPageHdr;
u16 *aCellIdx;