tsdbFile.h 1.5 KB
Newer Older
H
more  
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * 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/>.
 */
H
more  
Hongze Cheng 已提交
15 16 17
#if !defined(_TD_TSDB_FILE_H_)
#define _TD_TSDB_FILE_H_

H
more  
hzcheng 已提交
18 19
#include <stdint.h>
// #include "tstring.h"
H
more  
Hongze Cheng 已提交
20

H
more  
hzcheng 已提交
21 22 23 24
#ifdef __cplusplus
extern "C" {
#endif

H
more  
Hongze Cheng 已提交
25 26
typedef int32_t file_id_t;

H
Hongze Cheng 已提交
27 28 29 30 31
typedef enum {
  TSDB_FILE_TYPE_HEAD,  // .head file type
  TSDB_FILE_TYPE_DATA,  // .data file type
  TSDB_FILE_TYPE_LAST,  // .last file type
  TSDB_FILE_TYPE_META   // .meta file type
H
more  
Hongze Cheng 已提交
32 33
} TSDB_FILE_TYPE;

H
Hongze Cheng 已提交
34 35 36 37 38 39 40
const char *tsdbFileSuffix[] = {
  ".head",  // TSDB_FILE_TYPE_HEAD
  ".data",  // TSDB_FILE_TYPE_DATA
  ".last",  // TSDB_FILE_TYPE_LAST
  ".meta"   // TSDB_FILE_TYPE_META
};

H
more  
Hongze Cheng 已提交
41 42 43 44 45
typedef struct {
  int64_t fileSize;
} SFileInfo;

typedef struct {
H
more  
hzcheng 已提交
46
  char *    fname;
H
more  
Hongze Cheng 已提交
47
  SFileInfo fInfo;
H
more  
Hongze Cheng 已提交
48 49
} SFILE;

H
more  
hzcheng 已提交
50 51 52 53 54 55
// typedef struct {
//   int64_t offset;
//   int64_t skey;
//   int64_t ekey;
//   int16_t numOfBlocks;
// } SDataBlock;
H
more  
Hongze Cheng 已提交
56

H
Hongze Cheng 已提交
57
char *tsdbGetFileName(char *dirName, char *fname, TSDB_FILE_TYPE type);
H
more  
Hongze Cheng 已提交
58

H
more  
hzcheng 已提交
59 60 61 62
#ifdef __cplusplus
}
#endif

H
more  
Hongze Cheng 已提交
63
#endif  // _TD_TSDB_FILE_H_