refact
This commit is contained in:
parent
3934427cbe
commit
78313467e7
|
@ -16,7 +16,7 @@
|
||||||
#include "tdbInt.h"
|
#include "tdbInt.h"
|
||||||
|
|
||||||
struct STDB {
|
struct STDB {
|
||||||
TEnv *pEnv;
|
TENV *pEnv;
|
||||||
SBTree *pBt;
|
SBTree *pBt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ struct STDBC {
|
||||||
SBTC btc;
|
SBTC btc;
|
||||||
};
|
};
|
||||||
|
|
||||||
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TEnv *pEnv, TDB **ppDb) {
|
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TENV *pEnv, TDB **ppDb) {
|
||||||
TDB *pDb;
|
TDB *pDb;
|
||||||
SPager *pPager;
|
SPager *pPager;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
#include "tdbInt.h"
|
#include "tdbInt.h"
|
||||||
|
|
||||||
int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv) {
|
int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv) {
|
||||||
TEnv *pEnv;
|
TENV *pEnv;
|
||||||
int dsize;
|
int dsize;
|
||||||
int zsize;
|
int zsize;
|
||||||
u8 *pPtr;
|
u8 *pPtr;
|
||||||
|
@ -32,7 +32,7 @@ int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pEnv = (TEnv *)pPtr;
|
pEnv = (TENV *)pPtr;
|
||||||
pPtr += sizeof(*pEnv);
|
pPtr += sizeof(*pEnv);
|
||||||
// pEnv->rootDir
|
// pEnv->rootDir
|
||||||
pEnv->rootDir = pPtr;
|
pEnv->rootDir = pPtr;
|
||||||
|
@ -59,12 +59,12 @@ int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tdbEnvClose(TEnv *pEnv) {
|
int tdbEnvClose(TENV *pEnv) {
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPager *tdbEnvGetPager(TEnv *pEnv, const char *fname) {
|
SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) {
|
||||||
// TODO
|
// TODO
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
|
@ -15,17 +15,17 @@
|
||||||
|
|
||||||
#include "tdbInt.h"
|
#include "tdbInt.h"
|
||||||
|
|
||||||
int tdbTxnBegin(TEnv *pEnv) {
|
int tdbTxnBegin(TENV *pEnv) {
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tdbTxnCommit(TEnv *pEnv) {
|
int tdbTxnCommit(TENV *pEnv) {
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tdbTxnRollback(TEnv *pEnv) {
|
int tdbTxnRollback(TENV *pEnv) {
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -24,7 +24,7 @@ typedef struct STDB TDB;
|
||||||
typedef struct STDBC TDBC;
|
typedef struct STDBC TDBC;
|
||||||
|
|
||||||
// TDB
|
// TDB
|
||||||
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TEnv *pEnv, TDB **ppDb);
|
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, TENV *pEnv, TDB **ppDb);
|
||||||
int tdbDbClose(TDB *pDb);
|
int tdbDbClose(TDB *pDb);
|
||||||
int tdbDbDrop(TDB *pDb);
|
int tdbDbDrop(TDB *pDb);
|
||||||
int tdbDbInsert(TDB *pDb, const void *pKey, int keyLen, const void *pVal, int valLen);
|
int tdbDbInsert(TDB *pDb, const void *pKey, int keyLen, const void *pVal, int valLen);
|
||||||
|
|
|
@ -25,12 +25,12 @@ typedef struct STEnv {
|
||||||
char *jfname;
|
char *jfname;
|
||||||
int jfd;
|
int jfd;
|
||||||
SPCache *pCache;
|
SPCache *pCache;
|
||||||
} TEnv;
|
} TENV;
|
||||||
|
|
||||||
int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TEnv **ppEnv);
|
int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv);
|
||||||
int tdbEnvClose(TEnv *pEnv);
|
int tdbEnvClose(TENV *pEnv);
|
||||||
|
|
||||||
SPager *tdbEnvGetPager(TEnv *pEnv, const char *fname);
|
SPager *tdbEnvGetPager(TENV *pEnv, const char *fname);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@ struct STxn {
|
||||||
void *xArg;
|
void *xArg;
|
||||||
};
|
};
|
||||||
|
|
||||||
int tdbTxnBegin(TEnv *pEnv);
|
int tdbTxnBegin(TENV *pEnv);
|
||||||
int tdbTxnCommit(TEnv *pEnv);
|
int tdbTxnCommit(TENV *pEnv);
|
||||||
int tdbTxnRollback(TEnv *pEnv);
|
int tdbTxnRollback(TENV *pEnv);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in
|
||||||
|
|
||||||
TEST(tdb_test, simple_test) {
|
TEST(tdb_test, simple_test) {
|
||||||
int ret;
|
int ret;
|
||||||
TEnv *pEnv;
|
TENV *pEnv;
|
||||||
TDB *pDb;
|
TDB *pDb;
|
||||||
FKeyComparator compFunc;
|
FKeyComparator compFunc;
|
||||||
int nData = 1000000;
|
int nData = 1000000;
|
||||||
|
|
Loading…
Reference in New Issue