提交 6276f2c3 编写于 作者: H Hongze Cheng

refact

上级 b8ac2d30
......@@ -15,13 +15,13 @@
#include "tdbInt.h"
struct STDb {
struct STDB {
STEnv *pEnv;
SBTree *pBt;
};
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb) {
STDb *pDb;
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDB **ppDb) {
STDB *pDb;
SPager *pPager;
int ret;
char fFullName[TDB_FILENAME_LEN];
......@@ -30,7 +30,7 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF
*ppDb = NULL;
pDb = (STDb *)calloc(1, sizeof(*pDb));
pDb = (STDB *)calloc(1, sizeof(*pDb));
if (pDb == NULL) {
return -1;
}
......@@ -59,17 +59,17 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF
return 0;
}
int tdbDbClose(STDb *pDb) {
int tdbDbClose(STDB *pDb) {
// TODO
return 0;
}
int tdbDbDrop(STDb *pDb) {
int tdbDbDrop(STDB *pDb) {
// TODO
return 0;
}
int tdbDbInsert(STDb *pDb, const void *pKey, int keyLen, const void *pVal, int valLen) {
int tdbDbInsert(STDB *pDb, const void *pKey, int keyLen, const void *pVal, int valLen) {
SBTC btc;
SBTC *pCur;
int ret;
......@@ -88,6 +88,6 @@ int tdbDbInsert(STDb *pDb, const void *pKey, int keyLen, const void *pVal, int v
return 0;
}
int tdbDbGet(STDb *pDb, const void *pKey, int kLen, void **ppVal, int *vLen) {
int tdbDbGet(STDB *pDb, const void *pKey, int kLen, void **ppVal, int *vLen) {
return tdbBtreeGet(pDb->pBt, pKey, kLen, ppVal, vLen);
}
\ No newline at end of file
......@@ -20,14 +20,14 @@
extern "C" {
#endif
typedef struct STDb STDb;
typedef struct STDB STDB;
typedef struct STDbC STDbC;
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDb **ppDb);
int tdbDbClose(STDb *pDb);
int tdbDbDrop(STDb *pDb);
int tdbDbInsert(STDb *pDb, const void *pKey, int keyLen, const void *pVal, int valLen);
int tdbDbGet(STDb *pDb, const void *pKey, int kLen, void **ppVal, int *vLen);
int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprFn, STEnv *pEnv, STDB **ppDb);
int tdbDbClose(STDB *pDb);
int tdbDbDrop(STDB *pDb);
int tdbDbInsert(STDB *pDb, const void *pKey, int keyLen, const void *pVal, int valLen);
int tdbDbGet(STDB *pDb, const void *pKey, int kLen, void **ppVal, int *vLen);
#ifdef __cplusplus
}
......
......@@ -95,7 +95,7 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) {
// tdb_log
#define tdbError(var)
typedef TD_DLIST(STDb) STDbList;
typedef TD_DLIST(STDB) STDbList;
typedef TD_DLIST(SPgFile) SPgFileList;
typedef TD_DLIST_NODE(SPgFile) SPgFileListNode;
......
......@@ -5,7 +5,7 @@
TEST(tdb_test, simple_test) {
int ret;
STEnv *pEnv;
STDb *pDb;
STDB *pDb;
int nData = 10000000;
// Open Env
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册