From d83540ae744750988981f4d6dcbbda72c6e51154 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 11 Feb 2022 01:30:26 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/src/db/btree.c | 8 +++++++- source/libs/tdb/src/inc/btree.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/db/btree.c b/source/libs/tdb/src/db/btree.c index 53f2fa6c77..8e308b63b9 100644 --- a/source/libs/tdb/src/db/btree.c +++ b/source/libs/tdb/src/db/btree.c @@ -21,6 +21,11 @@ struct SBtCursor { SPage * pPage; // current page traversing }; +typedef struct { + pgno_t pgno; + pgsize_t offset; +} SBtIdx; + static int btreeCreate(SBTree **pBt); static int btreeDestroy(SBTree *pBt); static int btreeCursorMoveToChild(SBtCursor *pBtCur, pgno_t pgno); @@ -63,9 +68,10 @@ int btreeCursorClose(SBtCursor *pBtCur) { return 0; } -int btreeCursorMoveTo(SBtCursor *pBtCur) { +int btreeCursorMoveTo(SBtCursor *pBtCur, int kLen, const void *pKey) { SPage *pPage; pgno_t childPgno; + int idx; // 1. Move the cursor to the root page diff --git a/source/libs/tdb/src/inc/btree.h b/source/libs/tdb/src/inc/btree.h index ec73f3651b..343093edc9 100644 --- a/source/libs/tdb/src/inc/btree.h +++ b/source/libs/tdb/src/inc/btree.h @@ -30,7 +30,7 @@ int btreeClose(SBTree *pBt); // SBtCursor int btreeCursorOpen(SBtCursor *pBtCur, SBTree *pBt); int btreeCursorClose(SBtCursor *pBtCur); -int btreeCursorMoveTo(SBtCursor *pBtCur); +int btreeCursorMoveTo(SBtCursor *pBtCur, int kLen, const void *pKey); struct SBTree { pgno_t root; -- GitLab