diff --git a/src/vnode/CMakeLists.txt b/src/vnode/CMakeLists.txt index 5acf0483ec67c3d23573d7ac2dd42604e001276c..22770e379906aeb5d226a38b05e45da144323dc2 100644 --- a/src/vnode/CMakeLists.txt +++ b/src/vnode/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required(VERSION 2.8) -project(tsdb) - add_subdirectory(common) add_subdirectory(tsdb) diff --git a/src/vnode/common/inc/type.h b/src/vnode/common/inc/type.h index 685fc2e24018d8a47227082e778c52fe70bee38a..1aaa95cb90baa041a98dff971cbf4ef47e7ced55 100644 --- a/src/vnode/common/inc/type.h +++ b/src/vnode/common/inc/type.h @@ -16,18 +16,7 @@ typedef enum { TD_DATATYPE_BINARY } td_datatype_t; -const int32_t rowDataLen[] = { - sizeof(int8_t), // TD_DATATYPE_BOOL, - sizeof(int8_t), // TD_DATATYPE_TINYINT, - sizeof(int16_t), // TD_DATATYPE_SMALLINT, - sizeof(int32_t), // TD_DATATYPE_INT, - sizeof(int64_t), // TD_DATATYPE_BIGINT, - sizeof(float), // TD_DATATYPE_FLOAT, - sizeof(double), // TD_DATATYPE_DOUBLE, - sizeof(int32_t), // TD_DATATYPE_VARCHAR, - sizeof(int32_t), // TD_DATATYPE_NCHAR, - sizeof(int32_t) // TD_DATATYPE_BINARY -}; +extern const int32_t rowDataLen[]; // TODO: finish below #define TD_DATATYPE_BOOL_NULL diff --git a/src/vnode/common/src/dataformat.c b/src/vnode/common/src/dataformat.c index f09ea1445b089cdf2944a902c0c744ed73f6deef..18b78a4129fe2685973e1f6f83dd6e2af75766e6 100644 --- a/src/vnode/common/src/dataformat.c +++ b/src/vnode/common/src/dataformat.c @@ -29,4 +29,8 @@ int32_t tdGetMaxDataRowSize(SSchema *pSchema) { nbytes += TD_DATA_ROW_HEADER_SIZE; return nbytes; +} + +SDataRow tdSDataRowDup(SDataRow rdata) { + return NULL; } \ No newline at end of file diff --git a/src/vnode/common/src/schema.c b/src/vnode/common/src/schema.c index 79b41533d23a0ef5ae8ace9da67e9416d5f604b0..eb1b4eb84b3d716c7091553ffde83135b75fc691 100644 --- a/src/vnode/common/src/schema.c +++ b/src/vnode/common/src/schema.c @@ -1,6 +1,18 @@ #include #include "schema.h" +const int32_t rowDataLen[] = { + sizeof(int8_t), // TD_DATATYPE_BOOL, + sizeof(int8_t), // TD_DATATYPE_TINYINT, + sizeof(int16_t), // TD_DATATYPE_SMALLINT, + sizeof(int32_t), // TD_DATATYPE_INT, + sizeof(int64_t), // TD_DATATYPE_BIGINT, + sizeof(float), // TD_DATATYPE_FLOAT, + sizeof(double), // TD_DATATYPE_DOUBLE, + sizeof(int32_t), // TD_DATATYPE_VARCHAR, + sizeof(int32_t), // TD_DATATYPE_NCHAR, + sizeof(int32_t) // TD_DATATYPE_BINARY +}; static size_t tdGetEstimatedISchemaLen(SSchema *pSchema) { size_t colNameLen = 0; @@ -82,4 +94,8 @@ int32_t tdGetColumnIdxById(SSchema *pSchema, int32_t colId) { } } return -1; +} + +SSchema *tdDupSchema(SSchema *pSchema) { + return NULL; } \ No newline at end of file diff --git a/src/vnode/tests/tsdb/tsdbTests.cpp b/src/vnode/tests/tsdb/tsdbTests.cpp index 3d7f41df24177793e0df01f4e59e53954edf4194..8e1b37b191d84b7f3c7316ea5e48e2228d6e1752 100644 --- a/src/vnode/tests/tsdb/tsdbTests.cpp +++ b/src/vnode/tests/tsdb/tsdbTests.cpp @@ -4,9 +4,19 @@ #include "tsdb.h" TEST(TsdbTest, createTsdbRepo) { - STsdbCfg *pCfg = (STsdbCfg *)malloc(sizeof(STsdbCfg)); + STsdbCfg config; - free(pCfg); + config.precision = TSDB_PRECISION_MILLI; + config.tsdbId = 0; + config.maxTables = 100; + config.daysPerFile = 10; + config.minRowsPerFileBlock = 100; + config.maxRowsPerFileBlock = 4096; + config.maxCacheSize = 4 * 1024 * 1024; - ASSERT_EQ(1, 2/2); + tsdb_repo_t *pRepo = tsdbCreateRepo("/root/mnt/test/vnode0", &config, NULL); + + ASSERT_NE(pRepo, nullptr); + + tsdbCloseRepo(pRepo); } \ No newline at end of file diff --git a/src/vnode/tsdb/CMakeLists.txt b/src/vnode/tsdb/CMakeLists.txt index ed924109a7cca1cc5606ce50490fbc6eaa656f8a..4e66b98528b10685163fcf99880fe6c025709b10 100644 --- a/src/vnode/tsdb/CMakeLists.txt +++ b/src/vnode/tsdb/CMakeLists.txt @@ -1,7 +1,7 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCE_LIST) add_library(tsdb STATIC ${SOURCE_LIST}) -target_link_libraries(tsdb common) +target_link_libraries(tsdb common tutil) target_include_directories(tsdb PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/inc" diff --git a/src/vnode/tsdb/inc/tsdbFile.h b/src/vnode/tsdb/inc/tsdbFile.h index 2dda32380560c477b5d24034d3629ad23b609d5c..39d1b0b3c2d573b1b3169cf2214ff9657e23f3c9 100644 --- a/src/vnode/tsdb/inc/tsdbFile.h +++ b/src/vnode/tsdb/inc/tsdbFile.h @@ -31,12 +31,13 @@ typedef enum { TSDB_FILE_TYPE_META // .meta file type } TSDB_FILE_TYPE; -const char *tsdbFileSuffix[] = { - ".head", // TSDB_FILE_TYPE_HEAD - ".data", // TSDB_FILE_TYPE_DATA - ".last", // TSDB_FILE_TYPE_LAST - ".meta" // TSDB_FILE_TYPE_META -}; +extern const char *tsdbFileSuffix[]; +// const char *tsdbFileSuffix[] = { +// ".head", // TSDB_FILE_TYPE_HEAD +// ".data", // TSDB_FILE_TYPE_DATA +// ".last", // TSDB_FILE_TYPE_LAST +// ".meta" // TSDB_FILE_TYPE_META +// }; typedef struct { int64_t fileSize;