2021-09-22 05:21:07 +00:00
|
|
|
/*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2021-09-22 07:31:07 +00:00
|
|
|
#ifndef _TD_META_H_
|
|
|
|
|
#define _TD_META_H_
|
2021-09-22 05:21:07 +00:00
|
|
|
|
2021-12-16 07:28:53 +00:00
|
|
|
#include "mallocator.h"
|
2021-11-22 07:02:53 +00:00
|
|
|
#include "os.h"
|
2021-12-25 08:54:28 +00:00
|
|
|
#include "tmsg.h"
|
2021-12-28 05:58:53 +00:00
|
|
|
#include "trow.h"
|
2021-10-08 02:38:22 +00:00
|
|
|
|
2021-09-22 05:21:07 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-10-08 02:38:22 +00:00
|
|
|
// Types exported
|
2021-11-22 07:02:53 +00:00
|
|
|
typedef struct SMeta SMeta;
|
|
|
|
|
|
2021-11-26 06:49:26 +00:00
|
|
|
#define META_SUPER_TABLE 0
|
|
|
|
|
#define META_CHILD_TABLE 1
|
|
|
|
|
#define META_NORMAL_TABLE 2
|
|
|
|
|
|
2021-11-22 07:02:53 +00:00
|
|
|
typedef struct SMetaCfg {
|
|
|
|
|
/// LRU cache size
|
|
|
|
|
uint64_t lruSize;
|
|
|
|
|
} SMetaCfg;
|
|
|
|
|
|
2021-12-25 08:54:28 +00:00
|
|
|
typedef SVCreateTbReq STbCfg;
|
2021-10-08 02:38:22 +00:00
|
|
|
|
|
|
|
|
// SMeta operations
|
2021-12-16 07:28:53 +00:00
|
|
|
SMeta *metaOpen(const char *path, const SMetaCfg *pMetaCfg, SMemAllocatorFactory *pMAF);
|
2021-11-12 02:53:52 +00:00
|
|
|
void metaClose(SMeta *pMeta);
|
2021-11-02 02:33:53 +00:00
|
|
|
void metaRemove(const char *path);
|
2021-11-29 03:37:26 +00:00
|
|
|
int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg);
|
2021-11-29 03:53:31 +00:00
|
|
|
int metaDropTable(SMeta *pMeta, tb_uid_t uid);
|
2021-11-12 02:53:52 +00:00
|
|
|
int metaCommit(SMeta *pMeta);
|
2021-10-08 02:38:22 +00:00
|
|
|
|
2021-12-28 05:58:53 +00:00
|
|
|
// For Query
|
2021-12-28 08:22:35 +00:00
|
|
|
int metaGetTableInfo(SMeta *pMeta, char *tbname, STableMetaMsg **ppMsg);
|
2021-12-28 05:58:53 +00:00
|
|
|
|
2021-10-08 02:38:22 +00:00
|
|
|
// Options
|
2021-12-16 07:24:33 +00:00
|
|
|
void metaOptionsInit(SMetaCfg *pMetaCfg);
|
|
|
|
|
void metaOptionsClear(SMetaCfg *pMetaCfg);
|
2021-09-27 02:49:36 +00:00
|
|
|
|
2021-09-22 05:21:07 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-10-08 05:35:55 +00:00
|
|
|
#endif /*_TD_META_H_*/
|