more TDB
This commit is contained in:
parent
8d04fb6471
commit
f571942846
|
@ -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 @@
|
||||||
struct STDbEnv {
|
struct STDbEnv {
|
||||||
TDB * dbList; // TDB list
|
TDB * dbList; // TDB list
|
||||||
SPgFile *pgFileList; // SPgFile list
|
SPgFile *pgFileList; // SPgFile list
|
||||||
|
SPgCache pgc; // page cache
|
||||||
};
|
};
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* 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_*/
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue