mndConsumer.h 1.8 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 21 22 23 24
/*
 * 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_MND_CONSUMER_H_
#define _TD_MND_CONSUMER_H_

#include "mndInt.h"

#ifdef __cplusplus
extern "C" {
#endif

L
Liu Jicong 已提交
25
enum {
26
  MQ_CONSUMER_STATUS_REBALANCE = 1,
wmmhello's avatar
wmmhello 已提交
27
//  MQ_CONSUMER_STATUS__MODIFY_IN_REB,     // this value is not used anymore
wmmhello's avatar
wmmhello 已提交
28 29
  MQ_CONSUMER_STATUS_READY,
  MQ_CONSUMER_STATUS_LOST,
wmmhello's avatar
wmmhello 已提交
30
//  MQ_CONSUMER_STATUS__LOST_IN_REB,       // this value is not used anymore
wmmhello's avatar
wmmhello 已提交
31 32
//  MQ_CONSUMER_STATUS__LOST_REBD,
};\
L
Liu Jicong 已提交
33

L
Liu Jicong 已提交
34 35
int32_t mndInitConsumer(SMnode *pMnode);
void    mndCleanupConsumer(SMnode *pMnode);
36
void    mndDropConsumerFromSdb(SMnode *pMnode, int64_t consumerId);
L
Liu Jicong 已提交
37

L
Liu Jicong 已提交
38
SMqConsumerObj *mndAcquireConsumer(SMnode *pMnode, int64_t consumerId);
L
Liu Jicong 已提交
39
void            mndReleaseConsumer(SMnode *pMnode, SMqConsumerObj *pConsumer);
L
Liu Jicong 已提交
40

41
SMqConsumerObj *mndCreateConsumer(int64_t consumerId, const char *cgroup);
L
Liu Jicong 已提交
42

L
Liu Jicong 已提交
43 44 45
SSdbRaw *mndConsumerActionEncode(SMqConsumerObj *pConsumer);
SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw);

46
int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer);
L
Liu Jicong 已提交
47
int32_t mndSetConsumerDropLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj *pConsumer);
48

L
Liu Jicong 已提交
49 50 51 52 53
bool mndRebTryStart();
void mndRebEnd();
void mndRebCntInc();
void mndRebCntDec();

L
Liu Jicong 已提交
54 55 56 57 58
#ifdef __cplusplus
}
#endif

#endif /*_TD_MND_CONSUMER_H_*/