diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h index daffad3b7946f51eb74d48b4b500b4d1838abe0d..bc1eb06078faf45d2e7c96e36c8ab0bdd830f761 100644 --- a/source/libs/tdb/inc/tdb.h +++ b/source/libs/tdb/inc/tdb.h @@ -34,6 +34,8 @@ int tdbEnvCreate(TENV **ppEnv); int tdbEnvOpen(TENV **ppEnv); int tdbEnvClose(TENV *pEnv); +int tdbEnvCommit(TENV *pEnv); + int tdbEnvSetPageSize(TENV *pEnv, pgsz_t szPage); int tdbEnvSetCacheSize(TENV *pEnv, cachesz_t szCache); pgsz_t tdbEnvGetPageSize(TENV *pEnv); @@ -44,6 +46,14 @@ int tdbCreate(TDB **ppDb); int tdbOpen(TDB **ppDb, const char *fname, const char *dbname, TENV *pEnv); int tdbClose(TDB *pDb); +int tdbSetKeyLen(TDB *pDb, int klen); +int tdbSetValLen(TDB *pDb, int vlen); +int tdbSetDup(TDB *pDb, int dup); + +int tdbGetKeyLen(TDB *pDb, int *pklen); +int tdbGetValLen(TDB *pDb, int *pvlen); +int tdbGetDup(TDB *pDb, int *pdup); + // TDBC #ifdef __cplusplus diff --git a/source/libs/tdb/src/inc/btree.h b/source/libs/tdb/src/inc/btree.h index 343093edc9c01ef70757af44a282396cd85ab268..f12184b3eb5f51f504d2b3d5419800a62d12e3c3 100644 --- a/source/libs/tdb/src/inc/btree.h +++ b/source/libs/tdb/src/inc/btree.h @@ -31,6 +31,7 @@ int btreeClose(SBTree *pBt); int btreeCursorOpen(SBtCursor *pBtCur, SBTree *pBt); int btreeCursorClose(SBtCursor *pBtCur); int btreeCursorMoveTo(SBtCursor *pBtCur, int kLen, const void *pKey); +int btreeCursorNext(SBtCursor *pBtCur); struct SBTree { pgno_t root; diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 5c532c23f25ba3953189dfaf0f32c0dd6ce78157..18ab940517d08deb01a81249afcedd0be641a593 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -93,6 +93,19 @@ typedef TD_DLIST(SPgFile) SPgFileList; } \ } while (0) +#define TDB_VARIANT_LEN -1 + +#define TDB_DECODE_PAYLOAD(pPayload, keyLen, pKey, valLen, pVal) \ + do { \ + if ((keyLen) == TDB_VARIANT_LEN) { \ + /* TODO */ \ + } \ + if ((valLen) == TDB_VARIANT_LEN) { \ + /* TODO */ \ + } \ + /* TODO */ \ + } while (0) + #include "tdbUtil.h" #include "btree.h"