meta.h 1.8 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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
refact  
Hongze Cheng 已提交
16 17
#ifndef _TD_META_H_
#define _TD_META_H_
H
refact  
Hongze Cheng 已提交
18

H
more  
Hongze Cheng 已提交
19
#include "mallocator.h"
H
refact  
Hongze Cheng 已提交
20
#include "os.h"
H
more  
Hongze Cheng 已提交
21
#include "tmsg.h"
H
more  
Hongze Cheng 已提交
22
#include "trow.h"
H
more  
Hongze Cheng 已提交
23

H
refact  
Hongze Cheng 已提交
24 25 26 27
#ifdef __cplusplus
extern "C" {
#endif

H
more  
Hongze Cheng 已提交
28
// Types exported
H
refact  
Hongze Cheng 已提交
29 30
typedef struct SMeta SMeta;

H
more  
Hongze Cheng 已提交
31 32 33 34
#define META_SUPER_TABLE 0
#define META_CHILD_TABLE 1
#define META_NORMAL_TABLE 2

H
refact  
Hongze Cheng 已提交
35 36 37 38 39
typedef struct SMetaCfg {
  /// LRU cache size
  uint64_t lruSize;
} SMetaCfg;

H
Hongze Cheng 已提交
40 41 42 43 44
typedef struct {
  int32_t  nCols;
  SSchema *pSchema;
} SSchemaWrapper;

H
more  
Hongze Cheng 已提交
45
typedef SVCreateTbReq STbCfg;
H
more  
Hongze Cheng 已提交
46 47

// SMeta operations
H
more  
Hongze Cheng 已提交
48
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF);
H
more  
Hongze Cheng 已提交
49
void   metaClose(SMeta *pMeta);
H
more  
Hongze Cheng 已提交
50
void   metaRemove(const char *path);
H
more  
Hongze Cheng 已提交
51
int    metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg);
H
more  
Hongze Cheng 已提交
52
int    metaDropTable(SMeta *pMeta, tb_uid_t uid);
H
more  
Hongze Cheng 已提交
53
int    metaCommit(SMeta *pMeta);
H
more  
Hongze Cheng 已提交
54

H
more  
Hongze Cheng 已提交
55
// For Query
H
Hongze Cheng 已提交
56 57 58
STbCfg *        metaGetTbInfoByUid(SMeta *pMeta, tb_uid_t uid);
STbCfg *        metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid);
SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline);
H
more  
Hongze Cheng 已提交
59

H
more  
Hongze Cheng 已提交
60
// Options
H
more  
Hongze Cheng 已提交
61 62
void metaOptionsInit(SMetaCfg *pMetaCfg);
void metaOptionsClear(SMetaCfg *pMetaCfg);
H
refact  
Hongze Cheng 已提交
63

H
refact  
Hongze Cheng 已提交
64 65 66 67
#ifdef __cplusplus
}
#endif

D
dapan1121 已提交
68
#endif /*_TD_META_H_*/