more work
This commit is contained in:
parent
218ab32666
commit
a195e51c9f
|
@ -22,20 +22,17 @@ struct SPage {
|
|||
typedef TD_DLIST(SPage) SPgList;
|
||||
|
||||
struct SPgCache {
|
||||
SPage *pages;
|
||||
|
||||
SPgList freeList;
|
||||
|
||||
SRWLatch mutex;
|
||||
pgsize_t pgsize;
|
||||
SPage * pages;
|
||||
SPgList freeList;
|
||||
struct {
|
||||
int32_t nbucket;
|
||||
struct {
|
||||
SRWLatch latch;
|
||||
TD_DLIST(SPage) ht;
|
||||
} * buckets;
|
||||
int32_t nbucket;
|
||||
SPgList *buckets;
|
||||
} pght; // page hash table
|
||||
};
|
||||
|
||||
int pgCacheCreate(SPgCache **ppPgCache) {
|
||||
int pgCacheCreate(SPgCache **ppPgCache, pgsize_t pgsize) {
|
||||
SPgCache *pPgCache;
|
||||
|
||||
pPgCache = (SPgCache *)calloc(1, sizeof(*pPgCache));
|
||||
|
@ -43,6 +40,10 @@ int pgCacheCreate(SPgCache **ppPgCache) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
pPgCache->pgsize = pgsize;
|
||||
|
||||
taosInitRWLatch(&(pPgCache->mutex));
|
||||
|
||||
*ppPgCache = pPgCache;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ typedef struct SPgCache SPgCache;
|
|||
typedef struct SPage SPage;
|
||||
|
||||
// SPgCache
|
||||
int pgCacheCreate(SPgCache **ppPgCache);
|
||||
int pgCacheCreate(SPgCache **ppPgCache, pgsize_t pgsize);
|
||||
int pgCacheDestroy(SPgCache *pPgCache);
|
||||
int pgCacheOpen(SPgCache *pPgCache);
|
||||
int pgCacheClose(SPgCache *pPgCache);
|
||||
|
|
Loading…
Reference in New Issue