dnode.h 1.6 KB
Newer Older
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/>.
 */

S
Shengliang Guan 已提交
16 17
#ifndef _TD_DNODE_H_
#define _TD_DNODE_H_
18

S
Shengliang Guan 已提交
19 20
#include "tdef.h"

21 22 23 24
#ifdef __cplusplus
extern "C" {
#endif

S
Shengliang Guan 已提交
25
/* ------------------------ TYPES EXPOSED ---------------- */
S
Shengliang Guan 已提交
26
typedef struct SDnode SDnode;
27

S
Shengliang Guan 已提交
28 29 30 31 32
/**
 * @brief Initialize the environment
 *
 * @return int32_t 0 for success and -1 for failure
 */
S
config  
Shengliang Guan 已提交
33
int32_t dndInit();
S
Shengliang Guan 已提交
34 35 36 37 38 39 40 41

/**
 * @brief clear the environment
 *
 */
void dndCleanup();

/* ------------------------ SDnode ----------------------- */
S
Shengliang Guan 已提交
42
typedef struct {
S
Shengliang Guan 已提交
43
  int32_t  numOfSupportVnodes;
S
Shengliang Guan 已提交
44
  uint16_t serverPort;
S
Shengliang Guan 已提交
45 46 47 48
  char     dataDir[TSDB_FILENAME_LEN];
  char     localEp[TSDB_EP_LEN];
  char     localFqdn[TSDB_FQDN_LEN];
  char     firstEp[TSDB_EP_LEN];
S
Shengliang Guan 已提交
49
  char     secondEp[TSDB_EP_LEN];
S
Shengliang Guan 已提交
50
} SDnodeObjCfg;
S
Shengliang Guan 已提交
51

S
Shengliang Guan 已提交
52 53 54
/**
 * @brief Initialize and start the dnode.
 *
S
Shengliang Guan 已提交
55
 * @param pCfg Config of the dnode.
S
Shengliang Guan 已提交
56 57
 * @return SDnode* The dnode object.
 */
S
Shengliang Guan 已提交
58
SDnode *dndCreate(SDnodeObjCfg *pCfg);
S
Shengliang Guan 已提交
59 60

/**
61
 * @brief Stop and cleanup the dnode.
S
Shengliang Guan 已提交
62
 *
63
 * @param pDnode The dnode object to close.
S
Shengliang Guan 已提交
64
 */
S
Shengliang Guan 已提交
65
void dndClose(SDnode *pDnode);
S
Shengliang Guan 已提交
66

67 68 69 70
#ifdef __cplusplus
}
#endif

S
Shengliang Guan 已提交
71
#endif /*_TD_DNODE_H_*/