From 8e8b07af4e28ae4ae4dded3840f7d60e3456ff43 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 13 Oct 2021 14:57:15 +0800 Subject: [PATCH] more --- include/libs/tkv/tkv.h | 1 + source/libs/tkv/inc/tkvRocksdb.h | 27 +++++++++++++++++++++ source/libs/tkv/src/tkvRocksdb.c | 14 +++++++++++ source/server/vnode/tsdb/src/tsdbMemTable.c | 22 ++++++++++++++++- 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 source/libs/tkv/inc/tkvRocksdb.h create mode 100644 source/libs/tkv/src/tkvRocksdb.c diff --git a/include/libs/tkv/tkv.h b/include/libs/tkv/tkv.h index 36041767cf..edade1dc36 100644 --- a/include/libs/tkv/tkv.h +++ b/include/libs/tkv/tkv.h @@ -34,6 +34,7 @@ STkvDb *tkvOpen(const STkvOpts *options, const char *path); void tkvClose(STkvDb *db); void tkvPut(STkvDb *db, const STkvWriteOpts *, const char *key, size_t keylen, const char *val, size_t vallen); char * tkvGet(STkvDb *db, const STkvReadOpts *, const char *key, size_t keylen, size_t *vallen); +void tkvCommit(STkvDb *db); // DB options STkvOpts *tkvOptsCreate(); diff --git a/source/libs/tkv/inc/tkvRocksdb.h b/source/libs/tkv/inc/tkvRocksdb.h new file mode 100644 index 0000000000..658deb335f --- /dev/null +++ b/source/libs/tkv/inc/tkvRocksdb.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ + +#ifndef _TD_TVK_ROCKSDB_H_ +#define _TD_TVK_ROCKSDB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_TVK_ROCKSDB_H_*/ \ No newline at end of file diff --git a/source/libs/tkv/src/tkvRocksdb.c b/source/libs/tkv/src/tkvRocksdb.c new file mode 100644 index 0000000000..6dea4a4e57 --- /dev/null +++ b/source/libs/tkv/src/tkvRocksdb.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * 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 . + */ \ No newline at end of file diff --git a/source/server/vnode/tsdb/src/tsdbMemTable.c b/source/server/vnode/tsdb/src/tsdbMemTable.c index a528419dd2..91700a37d6 100644 --- a/source/server/vnode/tsdb/src/tsdbMemTable.c +++ b/source/server/vnode/tsdb/src/tsdbMemTable.c @@ -13,4 +13,24 @@ * along with this program. If not, see . */ -#include "tsdbMemTable.h" \ No newline at end of file +#include "tsdbMemTable.h" + +STsdbMemTable *tsdbMemTableCreate(void *mallocator) { + STsdbMemTable *pTsdbMemTable = NULL; + + pTsdbMemTable = (STsdbMemTable *)malloc(sizeof(*pTsdbMemTable)); + if (pTsdbMemTable == NULL) { + return NULL; + } + + // TODO + + return pTsdbMemTable; +} + +void tsdbMemTableDestroy(STsdbMemTable *pTsdbMemTable) { + if (pTsdbMemTable) { + // TODO + free(pTsdbMemTable); + } +} \ No newline at end of file