提交 51adf7e2 编写于 作者: M Minghao Li

add raft store

上级 c67a14ad
......@@ -153,8 +153,6 @@ int32_t syncForwardToPeer(int64_t rid, const SSyncBuffer* pBuf, bool isWeak);
ESyncState syncGetMyRole(int64_t rid);
void syncGetNodesRole(int64_t rid, SNodesRole* pNodeRole);
int32_t syncStartEnv();
extern int32_t sDebugFlag;
#ifdef __cplusplus
......
......@@ -23,9 +23,23 @@ extern "C" {
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "syncInt.h"
#include "taosdef.h"
#include "trpc.h"
typedef struct SSyncEnv {
void *pTimer;
void *pTimerManager;
} SSyncEnv;
int32_t syncEnvStart();
int32_t syncEnvStop();
static int32_t doSyncEnvStart(SSyncEnv *pSyncEnv);
static int32_t doSyncEnvStop(SSyncEnv *pSyncEnv);
#ifdef __cplusplus
}
#endif
......
......@@ -14,13 +14,25 @@
*/
#include "syncEnv.h"
#include <assert.h>
#include "sync.h"
#include "syncInt.h"
int32_t syncStartEnv() {
sInfo("log: syncStartEnv \n");
SSyncEnv *gSyncEnv = NULL;
if (rpcInit() != 0) {
return -1;
}
}
\ No newline at end of file
int32_t syncEnvStart() {
int32_t ret;
gSyncEnv = (SSyncEnv *)malloc(sizeof(SSyncEnv));
assert(gSyncEnv != NULL);
ret = doSyncEnvStart(gSyncEnv);
return ret;
}
int32_t syncEnvStop() {
int32_t ret = doSyncEnvStop(gSyncEnv);
return ret;
}
static int32_t doSyncEnvStart(SSyncEnv *pSyncEnv) { return 0; }
static int32_t doSyncEnvStop(SSyncEnv *pSyncEnv) { return 0; }
......@@ -15,9 +15,13 @@
#include <stdint.h>
#include "sync.h"
#include "syncEnv.h"
#include "syncInt.h"
int32_t syncInit() { return 0; }
int32_t syncInit() {
int32_t ret = syncEnvStart();
return ret;
}
void syncCleanUp() {}
......
......@@ -30,13 +30,11 @@ int main() {
raftStorePersist(pRaftStore);
tsAsyncLog = 0;
taosInitLog((char *)"syncTest.log", 100000, 10);
sDebug("sync test");
syncStartEnv();
SSyncIO *syncIO = syncIOCreate();
assert(syncIO != NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册