more tkv and refact
This commit is contained in:
parent
093b982fa0
commit
c9118a52e6
|
@ -293,7 +293,7 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) {
|
||||||
if (vnodeInit(&vnodeOpt) != 0) {
|
if (vnodeInit(&vnodeOpt) != 0) {
|
||||||
dError("failed to init vnode since %s", terrstr());
|
dError("failed to init vnode since %s", terrstr());
|
||||||
dndCleanup();
|
dndCleanup();
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&dndEnv.cfg, pCfg, sizeof(SDnodeEnvCfg));
|
memcpy(&dndEnv.cfg, pCfg, sizeof(SDnodeEnvCfg));
|
||||||
|
|
|
@ -37,36 +37,18 @@ typedef int32_t (*PutReqToVQueryQFp)(SDnode *pDnode, struct SRpcMsg *pReq);
|
||||||
typedef struct SVnodeCfg {
|
typedef struct SVnodeCfg {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
SDnode *pDnode;
|
SDnode *pDnode;
|
||||||
|
|
||||||
/** vnode buffer pool options */
|
|
||||||
struct {
|
struct {
|
||||||
/** write buffer size */
|
|
||||||
uint64_t wsize;
|
uint64_t wsize;
|
||||||
uint64_t ssize;
|
uint64_t ssize;
|
||||||
uint64_t lsize;
|
uint64_t lsize;
|
||||||
/** use heap allocator or arena allocator */
|
|
||||||
bool isHeapAllocator;
|
bool isHeapAllocator;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** time to live of tables in this vnode */
|
|
||||||
uint32_t ttl;
|
uint32_t ttl;
|
||||||
|
|
||||||
/** data to keep in this vnode */
|
|
||||||
uint32_t keep;
|
uint32_t keep;
|
||||||
|
|
||||||
/** if TS data is eventually consistency */
|
|
||||||
bool isWeak;
|
bool isWeak;
|
||||||
|
|
||||||
/** TSDB config */
|
|
||||||
STsdbCfg tsdbCfg;
|
STsdbCfg tsdbCfg;
|
||||||
|
|
||||||
/** META config */
|
|
||||||
SMetaCfg metaCfg;
|
SMetaCfg metaCfg;
|
||||||
|
|
||||||
/** TQ config */
|
|
||||||
STqCfg tqCfg;
|
STqCfg tqCfg;
|
||||||
|
|
||||||
/** WAL config */
|
|
||||||
SWalCfg walCfg;
|
SWalCfg walCfg;
|
||||||
} SVnodeCfg;
|
} SVnodeCfg;
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,15 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TDB_BTREE = 0,
|
||||||
|
TDB_HASH,
|
||||||
|
TDB_HEAP,
|
||||||
|
} tdb_db_t;
|
||||||
|
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
typedef struct TDB TDB;
|
typedef struct TDB TDB;
|
||||||
typedef struct TDB_ENV TDB_ENV;
|
typedef struct TDB_CURSOR TDB_CURSOR;
|
||||||
|
|
||||||
// SKey
|
// SKey
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -32,6 +38,11 @@ typedef struct {
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
} TDB_KEY, TDB_VALUE;
|
} 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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,19 +23,14 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TDB_BTREE = 0,
|
|
||||||
TDB_HASH,
|
|
||||||
TDB_HEAP,
|
|
||||||
} tdb_db_t;
|
|
||||||
|
|
||||||
struct TDB {
|
struct TDB {
|
||||||
pgsize_t pageSize;
|
pgsize_t pageSize;
|
||||||
tdb_db_t type;
|
tdb_db_t type;
|
||||||
union {
|
union {
|
||||||
STkvBtree btree;
|
TDB_BTREE btree;
|
||||||
STkvhash hash;
|
TDB_HASH hash;
|
||||||
} dbimpl;
|
} dbam; // Different access methods
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* 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_*/
|
|
|
@ -1,10 +0,0 @@
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
#include "iostream"
|
|
||||||
|
|
||||||
#include "tDiskMgr.h"
|
|
||||||
|
|
||||||
TEST(tDiskMgrTest, simple_test) {
|
|
||||||
// TODO
|
|
||||||
std::cout << "This is in tDiskMgrTest::simple_test" << std::endl;
|
|
||||||
}
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
TEST(tdb_api_test, tdb_create_open_close_db_test) {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue