transportInt.h 2.6 KB
Newer Older
H
refact  
Hongze Cheng 已提交
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/>.
 */

H
Hongze Cheng 已提交
16 17
#ifndef _TD_TRANSPORT_INT_H_
#define _TD_TRANSPORT_INT_H_
H
refact  
Hongze Cheng 已提交
18

dengyihao's avatar
dengyihao 已提交
19 20 21 22
#include <uv.h>
#include "lz4.h"
#include "os.h"
#include "taoserror.h"
dengyihao's avatar
dengyihao 已提交
23
#include "tglobal.h"
dengyihao's avatar
dengyihao 已提交
24 25
#include "thash.h"
#include "tmsg.h"
dengyihao's avatar
dengyihao 已提交
26
#include "transLog.h"
dengyihao's avatar
dengyihao 已提交
27
#include "tref.h"
dengyihao's avatar
dengyihao 已提交
28 29 30
#include "trpc.h"
#include "tutil.h"

H
refact  
Hongze Cheng 已提交
31 32 33 34
#ifdef __cplusplus
extern "C" {
#endif

dengyihao's avatar
dengyihao 已提交
35 36 37
void* taosInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
void* taosInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);

dengyihao's avatar
dengyihao 已提交
38 39 40
void taosCloseServer(void* arg);
void taosCloseClient(void* arg);

dengyihao's avatar
dengyihao 已提交
41 42 43 44 45 46 47
typedef struct {
  int      sessions;      // number of sessions allowed
  int      numOfThreads;  // number of threads to process incoming messages
  int      idleTime;      // milliseconds;
  uint16_t localPort;
  int8_t   connType;
  char     label[TSDB_LABEL_LEN];
dengyihao's avatar
dengyihao 已提交
48
  char     user[TSDB_UNI_LEN];  // meter ID
dengyihao's avatar
dengyihao 已提交
49
  int32_t  compatibilityVer;
dengyihao's avatar
dengyihao 已提交
50 51
  int32_t  compressSize;  // -1: no compress, 0 : all data compressed, size: compress data if larger than size
  int8_t   encryption;    // encrypt or not
dengyihao's avatar
dengyihao 已提交
52

dengyihao's avatar
dengyihao 已提交
53 54 55
  int32_t retryMinInterval;  // retry init interval
  int32_t retryStepFactor;   // retry interval factor
  int32_t retryMaxInterval;  // retry max interval
dengyihao's avatar
dengyihao 已提交
56
  int32_t retryMaxTimeout;
dengyihao's avatar
dengyihao 已提交
57

dengyihao's avatar
dengyihao 已提交
58 59 60
  int32_t failFastThreshold;
  int32_t failFastInterval;

dengyihao's avatar
dengyihao 已提交
61
  void (*cfp)(void* parent, SRpcMsg*, SEpSet*);
dengyihao's avatar
dengyihao 已提交
62
  bool (*retry)(int32_t code, tmsg_t msgType);
dengyihao's avatar
dengyihao 已提交
63
  bool (*startTimer)(int32_t code, tmsg_t msgType);
dengyihao's avatar
dengyihao 已提交
64
  void (*destroyFp)(void* ahandle);
dengyihao's avatar
dengyihao 已提交
65
  bool (*failFastFp)(tmsg_t msgType);
dengyihao's avatar
dengyihao 已提交
66

dengyihao's avatar
dengyihao 已提交
67 68 69 70 71
  int32_t       connLimitNum;
  int8_t        connLimitLock;  // 0: no lock. 1. lock
  int8_t        supportBatch;   // 0: no batch, 1: support batch
  int32_t       batchSize;
  int32_t       timeToGetConn;
dengyihao's avatar
dengyihao 已提交
72
  int           index;
dengyihao's avatar
dengyihao 已提交
73 74
  void*         parent;
  void*         tcphandle;  // returned handle from TCP initialization
dengyihao's avatar
dengyihao 已提交
75
  int64_t       refId;
wafwerar's avatar
wafwerar 已提交
76
  TdThreadMutex mutex;
dengyihao's avatar
dengyihao 已提交
77
} SRpcInfo;
dengyihao's avatar
dengyihao 已提交
78

H
refact  
Hongze Cheng 已提交
79 80 81 82
#ifdef __cplusplus
}
#endif

dengyihao's avatar
dengyihao 已提交
83
#endif /*_TD_TRANSPORT_INT_H_*/