vnodeWriteMsg.c 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/>.
 */

16 17 18
#define _DEFAULT_SOURCE
#include "os.h"
#include "vnodeWriteMsg.h"
H
refact  
Hongze Cheng 已提交
19

20
int32_t vnodeProcessSubmitReq(SVnode *pVnode, SSubmitReq *pReq, SSubmitRsp *pRsp) {
H
refact  
Hongze Cheng 已提交
21 22
  // TODO: Check inputs

H
Hongze Cheng 已提交
23
#if 0
H
refact  
Hongze Cheng 已提交
24
  void *pMem = NULL;
H
refact  
Hongze Cheng 已提交
25
  if ((pMem = amalloc(pVnode->allocator, REQ_SIZE(pReq))) == NULL) {
H
refact  
Hongze Cheng 已提交
26 27 28 29 30 31
    // No more memory to allocate, schedule an async commit
    // and continue
    vnodeAsyncCommit(pVnode);

    // Reset allocator and allocat more
    vnodeResetAllocator(pVnode);
H
refact  
Hongze Cheng 已提交
32
    pMem = amalloc(pVnode->allocator, REQ_SIZE(pReq));
H
refact  
Hongze Cheng 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    if (pMem == NULL) {
      // TODO: handle the error
    }
  }

  // TODO: if SSubmitReq is compressed or encoded, we need to decode the request
  memcpy(pMem, pReq, REQ_SIZE(pReq));

  if (tqPushMsg((SSubmitReq *)pReq) < 0) {
    // TODO: handle error
  }

  SSubmitReqReader reader;
  taosInitSubmitReqReader(&reader, (SSubmitReq *)pMem);

H
refact  
Hongze Cheng 已提交
48
  if (tsdbInsert(pVnode->pTsdb, (SSubmitReq *)pMem) < 0) {
H
refact  
Hongze Cheng 已提交
49 50
    // TODO: handler error
  }
H
Hongze Cheng 已提交
51
#endif
H
refact  
Hongze Cheng 已提交
52 53 54 55

  return 0;
}

56
int32_t vnodeProcessCreateTableReq(SVnode *pVnode, SCreateTableReq *pReq, SCreateTableRsp *pRsp) {
H
refact  
Hongze Cheng 已提交
57 58 59 60
  // TODO
  return 0;
}

61
 int32_t vnodeProcessDropTableReq(SVnode *pVnode, SDropTableReq *pReq, SDropTableRsp *pRsp) {
H
refact  
Hongze Cheng 已提交
62 63 64 65
  // TODO
  return 0;
}

66 67 68 69 70 71 72 73 74 75 76
int32_t vnodeProcessAlterTableReq(SVnode *pVnode, SAlterTableReq *pReq, SAlterTableRsp *pRsp) {
  // TODO
  return 0;
}

int32_t vnodeProcessDropStableReq(SVnode *pVnode, SDropStableReq *pReq, SDropStableRsp *pRsp) {
  // TODO
  return 0;
}

int32_t vnodeProcessUpdateTagValReq(SVnode *pVnode, SUpdateTagValReq *pReq, SUpdateTagValRsp *pRsp) {
H
refact  
Hongze Cheng 已提交
77 78 79
  // TODO
  return 0;
}
L
Liu Jicong 已提交
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

//mq related
int32_t vnodeProcessMqConnectReq(SVnode* pVnode, SMqConnectReq *pReq, SMqConnectRsp *pRsp){
  return 0;
}
int32_t vnodeProcessMqDisconnectReq(SVnode* pVnode, SMqConnectReq *pReq, SMqConnectRsp *pRsp) {
  return 0;
}
int32_t vnodeProcessMqAckReq(SVnode* pVnode, SMqAckReq *pReq, SMqAckRsp *pRsp) {
  return 0;
}
int32_t vnodeProcessMqResetReq(SVnode* pVnode, SMqResetReq *pReq, SMqResetRsp *pRsp) {
  return 0;
}
//mq related end