提交 4c32e5e3 编写于 作者: H Hongze Cheng

refact TDB

上级 7c66b2df
...@@ -28,7 +28,7 @@ struct SBTree { ...@@ -28,7 +28,7 @@ struct SBTree {
SPgno root; SPgno root;
int keyLen; int keyLen;
int valLen; int valLen;
SPager * pPager; SPager *pPager;
FKeyComparator kcmpr; FKeyComparator kcmpr;
u8 fanout; u8 fanout;
int pageSize; int pageSize;
...@@ -264,7 +264,7 @@ static int tdbEncodeLength(u8 *pBuf, uint32_t len) { ...@@ -264,7 +264,7 @@ static int tdbEncodeLength(u8 *pBuf, uint32_t len) {
static int tdbBtCursorMoveToRoot(SBtCursor *pCur) { static int tdbBtCursorMoveToRoot(SBtCursor *pCur) {
SBTree *pBt; SBTree *pBt;
SPager *pPager; SPager *pPager;
SPage * pPage; SPage *pPage;
int ret; int ret;
pBt = pCur->pBt; pBt = pCur->pBt;
......
...@@ -16,16 +16,16 @@ ...@@ -16,16 +16,16 @@
#include "tdbInt.h" #include "tdbInt.h"
struct STDb { struct STDb {
STEnv * pEnv; STEnv *pEnv;
SBTree *pBt; SBTree *pBt;
}; };
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb) { int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb) {
STDb * pDb; STDb *pDb;
SPager *pPager; SPager *pPager;
int ret; int ret;
char fFullName[TDB_FILENAME_LEN]; char fFullName[TDB_FILENAME_LEN];
SPage * pPage; SPage *pPage;
SPgno pgno; SPgno pgno;
*ppDb = NULL; *ppDb = NULL;
......
...@@ -20,10 +20,10 @@ struct SPCache { ...@@ -20,10 +20,10 @@ struct SPCache {
int extraSize; int extraSize;
pthread_mutex_t mutex; pthread_mutex_t mutex;
int nFree; int nFree;
SPage * pFree; SPage *pFree;
int nPage; int nPage;
int nHash; int nHash;
SPage ** pgHash; SPage **pgHash;
int nRecyclable; int nRecyclable;
SPage lru; SPage lru;
}; };
...@@ -49,8 +49,8 @@ static void tdbPCacheUnpinPage(SPage *pPage); ...@@ -49,8 +49,8 @@ static void tdbPCacheUnpinPage(SPage *pPage);
int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache) { int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache) {
SPCache *pCache; SPCache *pCache;
void * pPtr; void *pPtr;
SPage * pPgHdr; SPage *pPgHdr;
pCache = (SPCache *)calloc(1, sizeof(*pCache)); pCache = (SPCache *)calloc(1, sizeof(*pCache));
if (pCache == NULL) { if (pCache == NULL) {
...@@ -204,7 +204,7 @@ static void tdbPCacheUnpinPage(SPage *pPage) { ...@@ -204,7 +204,7 @@ static void tdbPCacheUnpinPage(SPage *pPage) {
static void tdbPCacheRemovePageFromHash(SPage *pPage) { static void tdbPCacheRemovePageFromHash(SPage *pPage) {
SPCache *pCache; SPCache *pCache;
SPage ** ppPage; SPage **ppPage;
int h; int h;
pCache = pPage->pCache; pCache = pPage->pCache;
...@@ -232,7 +232,7 @@ static void tdbPCacheAddPageToHash(SPage *pPage) { ...@@ -232,7 +232,7 @@ static void tdbPCacheAddPageToHash(SPage *pPage) {
static int tdbPCacheOpenImpl(SPCache *pCache) { static int tdbPCacheOpenImpl(SPCache *pCache) {
SPage *pPage; SPage *pPage;
u8 * pPtr; u8 *pPtr;
int tsize; int tsize;
tdbPCacheInitLock(pCache); tdbPCacheInitLock(pCache);
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include "tdbInt.h" #include "tdbInt.h"
struct SPager { struct SPager {
char * dbFileName; char *dbFileName;
char * jFileName; char *jFileName;
int pageSize; int pageSize;
uint8_t fid[TDB_FILE_ID_LEN]; uint8_t fid[TDB_FILE_ID_LEN];
int fd; int fd;
...@@ -26,8 +26,8 @@ struct SPager { ...@@ -26,8 +26,8 @@ struct SPager {
SPgno dbFileSize; SPgno dbFileSize;
SPgno dbOrigSize; SPgno dbOrigSize;
int nDirty; int nDirty;
SPage * pDirty; SPage *pDirty;
SPage * pDirtyTail; SPage *pDirtyTail;
u8 inTran; u8 inTran;
}; };
...@@ -49,7 +49,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage ...@@ -49,7 +49,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage
int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) { int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
uint8_t *pPtr; uint8_t *pPtr;
SPager * pPager; SPager *pPager;
int fsize; int fsize;
int zsize; int zsize;
int ret; int ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册