提交 2da826f9 编写于 作者: H Hongze Cheng

more

上级 473586ef
#if !defined(_TD_TYPE_H_)
#define _TD_TYPE_H_
typedef enum {
#include <stdint.h>
typedef enum : uint8_t {
TD_DATATYPE_INVLD = 0,
TD_DATATYPE_BOOL,
TD_DATATYPE_TINYINT,
......
......@@ -4,21 +4,37 @@
#define _TD_TSTRING_H_
#include <stdint.h>
#include <string.h>
#define TD_TSTRING_INIT_SIZE 16
typedef char* tstring_t;
// The string header
typedef struct {
int32_t strLen; // Allocated data space
int32_t avail; // Available space
int32_t space; // Allocated data space
char data[];
} STStrHdr;
// Get the data length of the string
#define TSTRLEN(pstr) ((STStrHdr *)pstr)->strLen
// Get the available space
#define TSTRAVAIL(pstr) ((STStrHdr *)pstr)->avail
#define TSTRLEN(pstr) strlen((char *)pstr)
// Get the real allocated string length
#define TSTRRLEN(pstr) ((STStrHdr *)pstr)->strLen + sizeof(STStrHdr)
#define TSTRSPACE(pstr) (*(int32_t *)((char *)pstr - sizeof(STStrHdr)))
// Get the available space
#define TSTAVAIL(pstr) (TSTRSPACE(pstr) - TSTRLEN(pstr))
// Create an empty tstring with default size
tstring_t tdNewTString();
// Create an empty tstring with size
tstring_t tdNewTStringWithSize(uint32_t size);
// Create a tstring with a init value
tstring_t tdNewTStringWithValue(char *value);
// Create a tstring with a init value & size
tstring_t tdNewTStringWithValueSize(char *value, uint32_t size);
tstring_t tstrcat(tstring_t dest, tstring_t src);
int32_t tstrcmp(tstring_t str1, tstring_t str2);
int32_t tstrncmp(tstring_t str1, tstring_t str2, int32_t n);
#endif // _TD_TSTRING_H_
#if !defined(_TD_TSDB_FILE_H_)
#define _TD_TSDB_FILE_H_
#include "tstring.h"
typedef int32_t file_id_t;
typedef enum : uint8_t {
TSDB_FILE_TYPE_HEAD,
TSDB_FILE_TYPE_DATA,
TSDB_FILE_TYPE_LAST,
TSDB_FILE_TYPE_META
} TSDB_FILE_TYPE;
typedef struct {
int64_t fileSize;
} SFileInfo;
typedef struct {
tstring_t fname;
SFileInfo;
} SFILE;
tstring_t tdGetHeadFileName(/* TODO */);
tstring_t tdGetDataFileName(/* TODO */);
tstring_t tdGetLastFileName(/* TODO */);
tstring_t tdGetMetaFileName(/* TODO */);
#endif // _TD_TSDB_FILE_H_
......@@ -51,6 +51,9 @@ typedef struct STable {
// Tag values for this table
char *pTagVal;
// Cached data
SSkipList *pData;
} STable;
#define TSDB_GET_TABLE_ID(pTable) (((STable *)pTable)->tid).tableId
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册