From 38d1d0e94bfc772d203247bc0f00843014823791 Mon Sep 17 00:00:00 2001 From: hzcheng Date: Thu, 5 Mar 2020 06:13:20 +0000 Subject: [PATCH] add declaration --- src/vnode/tsdb/src/tsdbCache.c | 14 ++++++++++++ src/vnode/tsdb/src/tsdbFile.c | 36 ++++++++++++++++++++++++++++++ src/vnode/tsdb/src/tsdbFileStore.c | 22 ------------------ 3 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 src/vnode/tsdb/src/tsdbFile.c delete mode 100644 src/vnode/tsdb/src/tsdbFileStore.c diff --git a/src/vnode/tsdb/src/tsdbCache.c b/src/vnode/tsdb/src/tsdbCache.c index f68c50c386..dfcafc0c32 100644 --- a/src/vnode/tsdb/src/tsdbCache.c +++ b/src/vnode/tsdb/src/tsdbCache.c @@ -1,3 +1,17 @@ +/* + * 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 . + */ #include #include "tsdbCache.h" diff --git a/src/vnode/tsdb/src/tsdbFile.c b/src/vnode/tsdb/src/tsdbFile.c new file mode 100644 index 0000000000..6009d160e3 --- /dev/null +++ b/src/vnode/tsdb/src/tsdbFile.c @@ -0,0 +1,36 @@ +/* + * 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 . + */ +#include +#include +#include + +#include "tsdbFile.h" + +const char *tsdbFileSuffix[] = { + ".head", // TSDB_FILE_TYPE_HEAD + ".data", // TSDB_FILE_TYPE_DATA + ".last", // TSDB_FILE_TYPE_LAST + ".meta" // TSDB_FILE_TYPE_META +}; + +char *tsdbGetFileName(char *dirName, char *fname, TSDB_FILE_TYPE type) { + if (!IS_VALID_TSDB_FILE_TYPE(type)) return NULL; + + char *fileName = (char *)malloc(strlen(dirName) + strlen(fname) + strlen(tsdbFileSuffix[type]) + 5); + if (fileName == NULL) return NULL; + + sprintf(fileName, "%s/%s%s", dirName, fname, tsdbFileSuffix[type]); + return fileName; +} \ No newline at end of file diff --git a/src/vnode/tsdb/src/tsdbFileStore.c b/src/vnode/tsdb/src/tsdbFileStore.c deleted file mode 100644 index 5c0702e296..0000000000 --- a/src/vnode/tsdb/src/tsdbFileStore.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include - -#include "tsdbFile.h" - -const char *tsdbFileSuffix[] = { - ".head", // TSDB_FILE_TYPE_HEAD - ".data", // TSDB_FILE_TYPE_DATA - ".last", // TSDB_FILE_TYPE_LAST - ".meta" // TSDB_FILE_TYPE_META -}; - -char *tsdbGetFileName(char *dirName, char *fname, TSDB_FILE_TYPE type) { - if (!IS_VALID_TSDB_FILE_TYPE(type)) return NULL; - - char *fileName = (char *)malloc(strlen(dirName) + strlen(fname) + strlen(tsdbFileSuffix[type]) + 5); - if (fileName == NULL) return NULL; - - sprintf(fileName, "%s/%s%s", dirName, fname, tsdbFileSuffix[type]); - return fileName; -} \ No newline at end of file