提交 f5719428 编写于 作者: H Hongze Cheng

more TDB

上级 8d04fb64
...@@ -14,21 +14,6 @@ ...@@ -14,21 +14,6 @@
*/ */
#include "tdbInt.h" #include "tdbInt.h"
typedef TD_DLIST(SPage) SPgList;
struct SPgCache {
SRWLatch mutex;
pgsize_t pgsize;
int32_t npage;
SPage * pages;
SPgList freeList;
SPgList lru;
struct {
int32_t nbucket;
SPgList *buckets;
} pght; // page hash table
};
static void pgCachePinPage(SPage *pPage); static void pgCachePinPage(SPage *pPage);
static void pgCacheUnpinPage(SPage *pPage); static void pgCacheUnpinPage(SPage *pPage);
......
...@@ -18,4 +18,5 @@ ...@@ -18,4 +18,5 @@
struct STDbEnv { struct STDbEnv {
TDB * dbList; // TDB list TDB * dbList; // TDB list
SPgFile *pgFileList; // SPgFile list SPgFile *pgFileList; // SPgFile list
SPgCache pgc; // page cache
}; };
\ No newline at end of file
...@@ -44,6 +44,21 @@ struct SPage { ...@@ -44,6 +44,21 @@ struct SPage {
uint8_t * pData; // real data uint8_t * pData; // real data
}; };
typedef TD_DLIST(SPage) SPgList;
struct SPgCache {
TENV * pEnv; // TENV containing this page cache
SRWLatch mutex;
pgsize_t pgsize;
int32_t npage;
SPage * pages;
SPgList freeList;
SPgList lru;
struct {
int32_t nbucket;
SPgList *buckets;
} pght; // page hash table
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TDB_ENV_H_
#define _TDB_ENV_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /*_TDB_ENV_H_*/
\ No newline at end of file
...@@ -79,6 +79,7 @@ typedef int32_t pgsize_t; ...@@ -79,6 +79,7 @@ typedef int32_t pgsize_t;
#include "btree.h" #include "btree.h"
#include "pgcache.h" #include "pgcache.h"
#include "pgfile.h" #include "pgfile.h"
#include "tdbEnv.h"
// tdb util // tdb util
int tdbGnrtFileID(const char *fname, uint8_t *fileid); int tdbGnrtFileID(const char *fname, uint8_t *fileid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册