From fb7e52f7cbd0f7e78a239dd5f1d7afd937d9abf1 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 23 Feb 2022 01:28:39 +0000 Subject: [PATCH] make it compile --- source/libs/tdb/src/db/tdbPgCache.c | 27 ++++++++++++++++++++++++++- source/libs/tdb/src/inc/tdbPgCache.h | 3 ++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPgCache.c b/source/libs/tdb/src/db/tdbPgCache.c index 1531da2343..17a2fbfe0b 100644 --- a/source/libs/tdb/src/db/tdbPgCache.c +++ b/source/libs/tdb/src/db/tdbPgCache.c @@ -35,6 +35,10 @@ struct SPgHdr { SPgHdr *pFreeNext; }; +static void tdbPCacheLock(SPCache *pCache); +static void tdbPCacheUnlock(SPCache *pCache); +static bool tdbPCacheLocked(SPCache *pCache); + int tdbOpenPCache(int pageSize, int cacheSize, int extraSize, SPCache **ppCache) { SPCache *pCache; void * pPtr; @@ -68,6 +72,27 @@ int tdbOpenPCache(int pageSize, int cacheSize, int extraSize, SPCache **ppCache) } int tdbClosePCache(SPCache *pCache) { - // TODO + /* TODO */ return 0; +} + +void *tdbPCacheFetch(SPCache *pCache, SPgid *pPgid) { + tdbPCacheLock(pCache); + // 1. search the hash table + tdbPCacheUnlock(pCache); + return NULL; +} + +void tdbPCacheRelease(void *pHdr) { + // TODO +} + +static void tdbPCacheLock(SPCache *pCache) { pthread_mutex_lock(&(pCache->mutex)); } + +static void tdbPCacheUnlock(SPCache *pCache) { pthread_mutex_unlock(&(pCache->mutex)); } + +static bool tdbPCacheLocked(SPCache *pCache) { + assert(0); + // TODO + return true; } \ No newline at end of file diff --git a/source/libs/tdb/src/inc/tdbPgCache.h b/source/libs/tdb/src/inc/tdbPgCache.h index 1ad001b6b8..72f690bf0a 100644 --- a/source/libs/tdb/src/inc/tdbPgCache.h +++ b/source/libs/tdb/src/inc/tdbPgCache.h @@ -25,7 +25,8 @@ typedef struct SPgHdr SPgHdr; int tdbOpenPCache(int pageSize, int cacheSize, int extraSize, SPCache **ppCache); int tdbPCacheClose(SPCache *pCache); -void *tdbPCacheFetch(SPCache *pCache); +void *tdbPCacheFetch(SPCache *pCache, SPgid *pPgid); +void tdbPCacheRelease(void *pHdr); #ifdef __cplusplus }