TDengine/include/dnode/snode/snode.h

80 lines
1.9 KiB
C
Raw Normal View History

2021-12-27 10:43:27 +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/>.
*/
#ifndef _TD_SNODE_H_
#define _TD_SNODE_H_
2022-03-07 08:30:28 +00:00
#include "tmsg.h"
2022-06-20 06:29:18 +00:00
#include "tmsgcb.h"
2022-03-07 08:30:28 +00:00
#include "trpc.h"
2021-12-27 10:43:27 +00:00
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------ TYPES EXPOSED ------------------------ */
2022-03-21 11:08:25 +00:00
typedef struct SSnode SSnode;
2021-12-27 10:43:27 +00:00
typedef struct {
2022-03-21 05:50:16 +00:00
int32_t reserved;
2021-12-27 10:43:27 +00:00
} SSnodeLoad;
typedef struct {
2022-03-21 11:08:25 +00:00
SMsgCb msgCb;
2021-12-27 10:43:27 +00:00
} SSnodeOpt;
/* ------------------------ SSnode ------------------------ */
/**
* @brief Start one Snode in Dnode.
*
2021-12-28 08:20:48 +00:00
* @param path Path of the snode.
2021-12-27 10:43:27 +00:00
* @param pOption Option of the snode.
* @return SSnode* The snode object.
*/
2021-12-28 08:20:48 +00:00
SSnode *sndOpen(const char *path, const SSnodeOpt *pOption);
2021-12-27 10:43:27 +00:00
2023-11-16 13:19:58 +00:00
int32_t sndInit(SSnode * pSnode);
2021-12-27 10:43:27 +00:00
/**
* @brief Stop Snode in Dnode.
*
* @param pSnode The snode object to close.
*/
void sndClose(SSnode *pSnode);
/**
* @brief Get the statistical information of Snode
*
* @param pSnode The snode object.
* @param pLoad Statistics of the snode.
* @return int32_t 0 for success, -1 for failure.
*/
int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad);
/**
* @brief Process a query message.
*
* @param pSnode The snode object.
* @param pMsg The request message
* @param pRsp The response message
*/
2022-10-28 09:03:17 +00:00
int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp);
int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg);
2021-12-28 08:20:48 +00:00
2021-12-27 10:43:27 +00:00
#ifdef __cplusplus
}
#endif
2022-03-07 08:30:28 +00:00
#endif /*_TD_SNODE_H_*/