dnode.h 1.7 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
tfs cfg  
Shengliang Guan 已提交
43 44 45 46 47 48 49 50 51
  int32_t   numOfSupportVnodes;
  uint16_t  serverPort;
  char      dataDir[TSDB_FILENAME_LEN];
  char      localEp[TSDB_EP_LEN];
  char      localFqdn[TSDB_FQDN_LEN];
  char      firstEp[TSDB_EP_LEN];
  char      secondEp[TSDB_EP_LEN];
  SDiskCfg *pDisks;
  int32_t   numOfDisks;
S
Shengliang Guan 已提交
52
} SDnodeObjCfg;
S
Shengliang Guan 已提交
53

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

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

69 70 71 72
#ifdef __cplusplus
}
#endif

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