提交 555c1507 编写于 作者: H hzcheng

more

上级 0ed08405
......@@ -2,6 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)
# ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(wal)
ADD_SUBDIRECTORY(tsdb)
# ENABLE_TESTING()
# ADD_SUBDIRECTORY(tests)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)
IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
INCLUDE_DIRECTORIES(${TD_OS_DIR}/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/dnode/inc)
INCLUDE_DIRECTORIES(inc)
AUX_SOURCE_DIRECTORY(src SRC)
ADD_LIBRARY(common ${SRC})
ENDIF ()
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "vnode.h"
#include "vnodeStatus.h"
int vnodeInitPeer(int numOfThreads) { return 0; }
void vnodeCleanUpPeer(int vnode) {}
int vnodeForwardToPeer(SMeterObj *pObj, char *cont, int contLen, char action, int sversion) { return 0; }
int vnodeRecoverFromPeer(SVnodeObj *pVnode, int fileId) { return -TSDB_CODE_FILE_CORRUPTED; }
void vnodeCloseAllSyncFds(int vnode) {}
void vnodeBroadcastStatusToUnsyncedPeer(SVnodeObj *pVnode) {}
int vnodeOpenPeerVnode(int vnode) {
SVnodeObj *pVnode = vnodeList + vnode;
pVnode->vnodeStatus = (pVnode->cfg.replications > 1) ? TSDB_VN_STATUS_UNSYNCED : TSDB_VN_STATUS_MASTER;
dPrint("vid:%d, status:%s numOfPeers:%d", vnode, taosGetVnodeStatusStr(pVnode->vnodeStatus), pVnode->cfg.replications - 1);
vnodeUpdateStreamRole(pVnode);
return 0;
}
void vnodeClosePeerVnode(int vnode) {}
void vnodeConfigVPeers(int vnode, int numOfPeers, SVPeerDesc peerDesc[]) {}
\ No newline at end of file
/* A dynamic string library
*/
#if !defined(_TD_TSTRING_H_)
#define _TD_TSTRING_H_
#include <stdint.h>
#include <string.h>
#define TD_TSTRING_INIT_SIZE 16
typedef char* tstring_t;
// The string header
typedef struct {
int32_t space; // Allocated data space
char data[];
} STStrHdr;
// Get the data length of the string
#define TSTRLEN(pstr) strlen((char *)pstr)
// Get the real allocated string length
#define TSTRSPACE(pstr) (*(int32_t *)((char *)pstr - sizeof(STStrHdr)))
// Get the available space
#define TSTAVAIL(pstr) (TSTRSPACE(pstr) - TSTRLEN(pstr))
// Create an empty tstring with default size
tstring_t tdNewTString();
// Create an empty tstring with size
tstring_t tdNewTStringWithSize(uint32_t size);
// Create a tstring with a init value
tstring_t tdNewTStringWithValue(char *value);
// Create a tstring with a init value & size
tstring_t tdNewTStringWithValueSize(char *value, uint32_t size);
tstring_t tstrcat(tstring_t dest, tstring_t src);
int32_t tstrcmp(tstring_t str1, tstring_t str2);
int32_t tstrncmp(tstring_t str1, tstring_t str2, int32_t n);
#endif // _TD_TSTRING_H_
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SRC)
ADD_LIBRARY(wal ${SRC})
TARGET_INCLUDE_DIRECTORIES(wal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)
\ No newline at end of file
......@@ -12,45 +12,16 @@
* 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 <stdlib.h>
#ifndef TDENGINE_VNODE_PEER_H
#define TDENGINE_VNODEPEER_H
#include "vnodeWal.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
/* TODO */
} SWal;
#include <stdint.h>
#include <stdbool.h>
#include "taosdef.h"
/*
* Initialize the resources
*/
int32_t vnodeInitPeers(int numOfThreads);
/*
* Free the resources
*/
void vnodeCleanUpPeers();
/*
* Start a vnode synchronization process
*/
int32_t vnodeOpenPeer(int32_t vnode);
/*
* Update the peerinfo of vnode
*/
int32_t vnodeConfigPeer(SVpeerDescArray msg);
/*
* Close a vnode synchronization process
*/
void vnodeCleanUpPeer(int32_t vnode);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_VNODEPEER_H
walh *vnodeOpenWal(int vnode, uint8_t op) { return NULL; }
int vnodeCloseWal(walh *pWal) { return 0; }
int vnodeRenewWal(walh *pWal) { return 0; }
int vnodeWriteWal(walh *pWal, void *cont, int contLen) { return 0; }
int vnodeSyncWal(walh *pWal) { return 0; }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册