sndInt.h 1.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/>.
 */

S
Shengliang Guan 已提交
16 17 18 19 20 21 22
#ifndef _TD_SNODE_INT_H_
#define _TD_SNODE_INT_H_

#include "os.h"

#include "tlog.h"
#include "tmsg.h"
L
Liu Jicong 已提交
23
#include "tqueue.h"
S
Shengliang Guan 已提交
24 25 26
#include "trpc.h"

#include "snode.h"
H
refact  
Hongze Cheng 已提交
27 28 29 30 31

#ifdef __cplusplus
extern "C" {
#endif

L
Liu Jicong 已提交
32
enum {
L
Liu Jicong 已提交
33
  STREAM_STATUS__RUNNING = 1,
L
Liu Jicong 已提交
34 35 36
  STREAM_STATUS__STOPPED,
  STREAM_STATUS__CREATING,
  STREAM_STATUS__STOPING,
L
Liu Jicong 已提交
37
  STREAM_STATUS__RESTORING,
L
Liu Jicong 已提交
38 39 40 41
  STREAM_STATUS__DELETING,
};

enum {
L
Liu Jicong 已提交
42 43
  STREAM_TASK_STATUS__RUNNING = 1,
  STREAM_TASK_STATUS__STOP,
L
Liu Jicong 已提交
44 45
};

L
Liu Jicong 已提交
46 47 48 49
typedef struct {
  SHashObj* pHash;  // taskId -> streamTask
} SStreamMeta;

S
Shengliang Guan 已提交
50
typedef struct SSnode {
L
Liu Jicong 已提交
51 52
  SStreamMeta* pMeta;
  SSnodeOpt    cfg;
S
Shengliang Guan 已提交
53 54
} SSnode;

L
Liu Jicong 已提交
55 56
typedef struct {
  int64_t streamId;
L
Liu Jicong 已提交
57
  int32_t taskId;
L
Liu Jicong 已提交
58 59
  int32_t IdxInLevel;
  int32_t level;
L
Liu Jicong 已提交
60
} SStreamTaskInfo;
L
Liu Jicong 已提交
61 62

typedef struct {
L
Liu Jicong 已提交
63 64 65 66
  SStreamTaskInfo meta;
  int8_t          status;
  void*           executor;
  void*           stateStore;
L
Liu Jicong 已提交
67
  // storage handle
L
Liu Jicong 已提交
68
} SStreamTask;
L
Liu Jicong 已提交
69 70 71 72 73 74 75

int32_t sndCreateStream();
int32_t sndDropStream();

int32_t sndStopStream();
int32_t sndResumeStream();

H
refact  
Hongze Cheng 已提交
76 77 78 79
#ifdef __cplusplus
}
#endif

L
Liu Jicong 已提交
80
#endif /*_TD_SNODE_INT_H_*/