From 98a1762aba041d6532bd10d8d544dae340c944bb Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 11 Feb 2022 09:11:30 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/inc/tdb.h | 10 ++++++++++ source/libs/tdb/src/inc/btree.h | 1 + source/libs/tdb/src/inc/tdbInt.h | 13 +++++++++++++ 3 files changed, 24 insertions(+) diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h index daffad3b79..bc1eb06078 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 343093edc9..f12184b3eb 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 5c532c23f2..18ab940517 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" -- GitLab