add raft store
This commit is contained in:
parent
c67a14ad8f
commit
51adf7e25e
|
@ -153,8 +153,6 @@ int32_t syncForwardToPeer(int64_t rid, const SSyncBuffer* pBuf, bool isWeak);
|
||||||
ESyncState syncGetMyRole(int64_t rid);
|
ESyncState syncGetMyRole(int64_t rid);
|
||||||
void syncGetNodesRole(int64_t rid, SNodesRole* pNodeRole);
|
void syncGetNodesRole(int64_t rid, SNodesRole* pNodeRole);
|
||||||
|
|
||||||
int32_t syncStartEnv();
|
|
||||||
|
|
||||||
extern int32_t sDebugFlag;
|
extern int32_t sDebugFlag;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -23,9 +23,23 @@ extern "C" {
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "syncInt.h"
|
||||||
#include "taosdef.h"
|
#include "taosdef.h"
|
||||||
#include "trpc.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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,13 +14,25 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "syncEnv.h"
|
#include "syncEnv.h"
|
||||||
|
#include <assert.h>
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
#include "syncInt.h"
|
#include "syncInt.h"
|
||||||
|
|
||||||
int32_t syncStartEnv() {
|
SSyncEnv *gSyncEnv = NULL;
|
||||||
sInfo("log: syncStartEnv \n");
|
|
||||||
|
|
||||||
if (rpcInit() != 0) {
|
int32_t syncEnvStart() {
|
||||||
return -1;
|
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 <stdint.h>
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
|
#include "syncEnv.h"
|
||||||
#include "syncInt.h"
|
#include "syncInt.h"
|
||||||
|
|
||||||
int32_t syncInit() { return 0; }
|
int32_t syncInit() {
|
||||||
|
int32_t ret = syncEnvStart();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void syncCleanUp() {}
|
void syncCleanUp() {}
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,11 @@ int main() {
|
||||||
|
|
||||||
raftStorePersist(pRaftStore);
|
raftStorePersist(pRaftStore);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tsAsyncLog = 0;
|
tsAsyncLog = 0;
|
||||||
taosInitLog((char *)"syncTest.log", 100000, 10);
|
taosInitLog((char *)"syncTest.log", 100000, 10);
|
||||||
|
|
||||||
sDebug("sync test");
|
sDebug("sync test");
|
||||||
syncStartEnv();
|
|
||||||
|
|
||||||
SSyncIO *syncIO = syncIOCreate();
|
SSyncIO *syncIO = syncIOCreate();
|
||||||
assert(syncIO != NULL);
|
assert(syncIO != NULL);
|
||||||
|
|
Loading…
Reference in New Issue