clientHb.h 1.4 KB
Newer Older
L
Liu Jicong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * 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/>.
 */

#include "os.h"
#include "tarray.h"
#include "thash.h"
#include "tmsg.h"

L
Liu Jicong 已提交
21 22
#define HEARTBEAT_INTERVAL 1500 //ms

L
Liu Jicong 已提交
23
typedef enum {
L
Liu Jicong 已提交
24 25
  HEARTBEAT_TYPE_MQ = 0,
  // types can be added here
L
Liu Jicong 已提交
26
  //
L
Liu Jicong 已提交
27 28 29
  HEARTBEAT_TYPE_MAX
} EHbType;

L
Liu Jicong 已提交
30
typedef int32_t (*FHbRspHandle)(SClientHbRsp* pReq);
L
Liu Jicong 已提交
31 32 33 34

//TODO: embed param into function
//return type: SArray<Skv>
typedef SArray* (*FGetConnInfo)(SClientHbKey connKey, void* param);
L
Liu Jicong 已提交
35

L
Liu Jicong 已提交
36
// called by mgmt
L
Liu Jicong 已提交
37
int  hbMgrInit(void* transporter, SEpSet epSet);
L
Liu Jicong 已提交
38
void hbMgrCleanUp();
L
Liu Jicong 已提交
39
int  hbHandleRsp(SClientHbBatchRsp* hbRsp);
L
Liu Jicong 已提交
40

L
Liu Jicong 已提交
41
//called by user
L
Liu Jicong 已提交
42
int hbRegisterConn(SClientHbKey connKey, FGetConnInfo func);
L
Liu Jicong 已提交
43
void hbDeregisterConn(SClientHbKey connKey);
L
Liu Jicong 已提交
44

L
Liu Jicong 已提交
45
int hbAddConnInfo(SClientHbKey connKey, void* key, void* value, int32_t keyLen, int32_t valueLen);
L
Liu Jicong 已提交
46

L
Liu Jicong 已提交
47 48
// mq
void hbMgrInitMqHbRspHandle();