add raft store

This commit is contained in:
Minghao Li 2022-02-24 21:03:25 +08:00
parent c67a14ad8f
commit 51adf7e25e
5 changed files with 38 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}
}
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; }

View File

@ -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() {}

View File

@ -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);