From ea7b4dcc538689efcec5e1135b8ce0e9dc201b41 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 9 Mar 2022 09:05:03 +0000 Subject: [PATCH] more TDB --- source/libs/tdb/src/db/tdbPage.c | 2 +- source/libs/tdb/src/inc/tdbPage.h | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index 8d283e5ed2..ffa94b14a4 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -15,7 +15,7 @@ #include "tdbInt.h" -int tdbPageInsertCell(SPage *pPage, int idx, u8 *pCell, int szCell) { +int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell) { // TODO return 0; } diff --git a/source/libs/tdb/src/inc/tdbPage.h b/source/libs/tdb/src/inc/tdbPage.h index 74145ba860..2e6a80acbc 100644 --- a/source/libs/tdb/src/inc/tdbPage.h +++ b/source/libs/tdb/src/inc/tdbPage.h @@ -20,6 +20,12 @@ extern "C" { #endif +typedef u8 SCell; + +typedef struct __attribute__((__packed__)) { + u8 cksm[4]; +} SPageFooter; + typedef struct __attribute__((__packed__)) { u16 flags; u16 nCells; @@ -38,15 +44,16 @@ struct SPage { TDB_PCACHE_PAGE // Fields below used by pager and am - SPageHdr *pPageHdr; - u16 *aCellIdx; - int kLen; - int vLen; - int maxLocal; - int minLocal; - int nOverflow; - void *apOvfl[4]; - int aiOvfl[4]; + SPageHdr *pPageHdr; + SPageFooter *pPageFooter; + u16 *aCellIdx; + int kLen; + int vLen; + int maxLocal; + int minLocal; + int nOverflow; + void *apOvfl[4]; + int aiOvfl[4]; }; // Macros @@ -88,7 +95,7 @@ struct SPage { #endif // APIs -int tdbPageInsertCell(SPage *pPage, int idx, u8 *pCell, int szCell); +int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell); int tdbPageDropCell(SPage *pPage, int idx); #ifdef __cplusplus