more TDB
This commit is contained in:
parent
79cdb9c275
commit
815233ae33
|
@ -15,6 +15,29 @@
|
||||||
|
|
||||||
#include "tdbInt.h"
|
#include "tdbInt.h"
|
||||||
|
|
||||||
|
struct SBTree {
|
||||||
|
SPgno root;
|
||||||
|
int keyLen;
|
||||||
|
int valLen;
|
||||||
|
SPFile *pFile;
|
||||||
|
int (*FKeyComparator)(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SBtCursor {
|
||||||
|
SBTree *pBt;
|
||||||
|
};
|
||||||
|
|
||||||
|
int tdbBtreeOpen(SPgno root, SBTree **ppBt) {
|
||||||
|
*ppBt = NULL;
|
||||||
|
/* TODO */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tdbBtreeClose(SBTree *pBt) {
|
||||||
|
// TODO
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
struct SBtCursor {
|
struct SBtCursor {
|
||||||
SBTree *pBtree;
|
SBTree *pBtree;
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct STEnv {
|
||||||
SPCache *pCache;
|
SPCache *pCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
int tdbEnvOpen(const char *rootDir, STEnv **ppEnv) {
|
int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, STEnv **ppEnv) {
|
||||||
STEnv * pEnv;
|
STEnv * pEnv;
|
||||||
int dsize;
|
int dsize;
|
||||||
int zsize;
|
int zsize;
|
||||||
|
@ -43,6 +43,10 @@ int tdbEnvOpen(const char *rootDir, STEnv **ppEnv) {
|
||||||
memcpy(pEnv->rootDir, rootDir, dsize);
|
memcpy(pEnv->rootDir, rootDir, dsize);
|
||||||
pEnv->rootDir[dsize] = '\0';
|
pEnv->rootDir[dsize] = '\0';
|
||||||
|
|
||||||
|
pEnv->jfd = -1;
|
||||||
|
|
||||||
|
tdbPCacheOpen(pageSize, cacheSize, 0, &(pEnv->pCache));
|
||||||
|
|
||||||
*ppEnv = pEnv;
|
*ppEnv = pEnv;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ SPgHdr *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, bool alcNewPage) {
|
||||||
return pPage;
|
return pPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tdbFetchFinish(SPCache *pCache, SPgHdr *pPage) {
|
void tdbPCacheFetchFinish(SPCache *pCache, SPgHdr *pPage) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ extern "C" {
|
||||||
|
|
||||||
typedef struct STEnv STEnv;
|
typedef struct STEnv STEnv;
|
||||||
|
|
||||||
int tdbEnvOpen(const char *rootDir, STEnv **ppEnv);
|
int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, STEnv **ppEnv);
|
||||||
int tdbEnvClose(STEnv *pEnv);
|
int tdbEnvClose(STEnv *pEnv);
|
||||||
|
|
||||||
int tdbEnvBegin(STEnv *pEnv);
|
int tdbEnvBegin(STEnv *pEnv);
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct SPgHdr {
|
||||||
int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache);
|
int tdbPCacheOpen(int pageSize, int cacheSize, int extraSize, SPCache **ppCache);
|
||||||
int tdbPCacheClose(SPCache *pCache);
|
int tdbPCacheClose(SPCache *pCache);
|
||||||
SPgHdr *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, bool alcNewPage);
|
SPgHdr *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, bool alcNewPage);
|
||||||
void tdbFetchFinish(SPCache *pCache, SPgHdr *pPage);
|
void tdbPCacheFetchFinish(SPCache *pCache, SPgHdr *pPage);
|
||||||
void tdbPCacheRelease(SPgHdr *pHdr);
|
void tdbPCacheRelease(SPgHdr *pHdr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -24,6 +24,7 @@ typedef struct SPFile SPFile;
|
||||||
|
|
||||||
int tdbPFileOpen(SPCache *pCache, const char *fileName, SPFile **ppFile);
|
int tdbPFileOpen(SPCache *pCache, const char *fileName, SPFile **ppFile);
|
||||||
int tdbPFileClose(SPFile *pFile);
|
int tdbPFileClose(SPFile *pFile);
|
||||||
|
void *tdbPFileGet(SPFile *pFile, SPgno pgno);
|
||||||
int tdbPFileBegin(SPFile *pFile);
|
int tdbPFileBegin(SPFile *pFile);
|
||||||
int tdbPFileCommit(SPFile *pFile);
|
int tdbPFileCommit(SPFile *pFile);
|
||||||
int tdbPFileRollback(SPFile *pFile);
|
int tdbPFileRollback(SPFile *pFile);
|
||||||
|
|
Loading…
Reference in New Issue