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

more tkv and refact

上级 093b982f
......@@ -293,7 +293,7 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) {
if (vnodeInit(&vnodeOpt) != 0) {
dError("failed to init vnode since %s", terrstr());
dndCleanup();
return NULL;
return -1;
}
memcpy(&dndEnv.cfg, pCfg, sizeof(SDnodeEnvCfg));
......
......@@ -37,36 +37,18 @@ typedef int32_t (*PutReqToVQueryQFp)(SDnode *pDnode, struct SRpcMsg *pReq);
typedef struct SVnodeCfg {
int32_t vgId;
SDnode *pDnode;
/** vnode buffer pool options */
struct {
/** write buffer size */
uint64_t wsize;
uint64_t ssize;
uint64_t lsize;
/** use heap allocator or arena allocator */
bool isHeapAllocator;
};
/** time to live of tables in this vnode */
uint32_t ttl;
/** data to keep in this vnode */
uint32_t keep;
/** if TS data is eventually consistency */
bool isWeak;
/** TSDB config */
STsdbCfg tsdbCfg;
/** META config */
SMetaCfg metaCfg;
/** TQ config */
STqCfg tqCfg;
/** WAL config */
SWalCfg walCfg;
} SVnodeCfg;
......
......@@ -22,9 +22,15 @@
extern "C" {
#endif
typedef enum {
TDB_BTREE = 0,
TDB_HASH,
TDB_HEAP,
} tdb_db_t;
// Forward declaration
typedef struct TDB TDB;
typedef struct TDB_ENV TDB_ENV;
typedef struct TDB TDB;
typedef struct TDB_CURSOR TDB_CURSOR;
// SKey
typedef struct {
......@@ -32,6 +38,11 @@ typedef struct {
uint32_t size;
} TDB_KEY, TDB_VALUE;
// TDB Operations
int tdbCreateDB(TDB** dbpp);
int tdbOpenDB(TDB* dbp, tdb_db_t type, uint32_t flags);
int tdbCloseDB(TDB* dbp, uint32_t flags);
#ifdef __cplusplus
}
#endif
......
......@@ -23,19 +23,14 @@
extern "C" {
#endif
typedef enum {
TDB_BTREE = 0,
TDB_HASH,
TDB_HEAP,
} tdb_db_t;
struct TDB {
pgsize_t pageSize;
tdb_db_t type;
union {
STkvBtree btree;
STkvhash hash;
} dbimpl;
TDB_BTREE btree;
TDB_HASH hash;
} dbam; // Different access methods
};
#ifdef __cplusplus
......
/*
* 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 _TD_TDB_ENV_H_
#define _TD_TDB_ENV_H_
#ifdef __cplusplus
extern "C" {
#endif
struct TDB_ENV {
char *homeDir;
};
#ifdef __cplusplus
}
#endif
#endif /*_TD_TDB_ENV_H_*/
\ No newline at end of file
#include "gtest/gtest.h"
#include "iostream"
#include "tDiskMgr.h"
TEST(tDiskMgrTest, simple_test) {
// TODO
std::cout << "This is in tDiskMgrTest::simple_test" << std::endl;
}
\ No newline at end of file
#include "gtest/gtest.h"
TEST(tdb_api_test, tdb_create_open_close_db_test) {
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册