add memallocator dependency

This commit is contained in:
Liu Jicong 2021-11-16 16:03:39 +08:00
parent 6cb65f4385
commit fed05bb64b
4 changed files with 85 additions and 60 deletions

View File

@ -18,6 +18,7 @@
#include "os.h"
#include "tutil.h"
#include "mallocator.h"
#ifdef __cplusplus
extern "C" {
@ -91,11 +92,9 @@ typedef struct tmqSubscribeRsp {
} TmqSubscribeRsp;
typedef struct TmqHeartbeatReq {
} TmqHeartbeatReq;
typedef struct TmqHeartbeatRsp {
} TmqHeartbeatRsp;
typedef struct TqTopicVhandle {
@ -107,10 +106,6 @@ typedef struct TqTopicVhandle {
void* (*mCallback)(void*, void*);
} TqTopicVhandle;
typedef struct STQ {
//the collection of group handle
//the handle of kvstore
} STQ;
#define TQ_BUFFER_SIZE 8
@ -159,9 +154,30 @@ typedef struct TqQueryMsg {
struct TqQueryMsg* next;
} TqQueryMsg;
//init in each vnode
STQ* tqInit(void* ref_func(void*), void* unref_func(void*));
void tqCleanUp(STQ*);
typedef struct TqLogReader {
void* logHandle;
int32_t (*walRead)(void* logHandle, void** data, int64_t ver);
int64_t (*walGetFirstVer)(void* logHandle);
int64_t (*walGetSnapshotVer)(void* logHandle);
int64_t (*walGetLastVer)(void* logHandle);
} TqLogReader;
typedef struct TqConfig {
// TODO
} TqConfig;
typedef struct STQ {
// the collection of group handle
// the handle of kvstore
const char* path;
TqConfig* tqConfig;
TqLogReader* tqLogReader;
SMemAllocatorFactory* allocFac;
} STQ;
// open in each vnode
STQ* tqOpen(const char* path, TqConfig* tqConfig, TqLogReader* tqLogReader, SMemAllocatorFactory *allocFac);
void tqDestroy(STQ*);
// void* will be replace by a msg type
int tqPushMsg(STQ*, void* msg, int64_t version);

View File

@ -75,9 +75,9 @@ int32_t walRead(SWal *, SWalHead **, int64_t ver);
int32_t walReadWithFp(SWal *, FWalWrite writeFp, int64_t verStart, int32_t readNum);
// lifecycle check
int32_t walFirstVer(SWal *);
int32_t walPersistedVer(SWal *);
int32_t walLastVer(SWal *);
int64_t walGetFirstVer(SWal *);
int64_t walGetSnapshotVer(SWal *);
int64_t walGetLastVer(SWal *);
// int32_t walDataCorrupted(SWal*);
#ifdef __cplusplus

View File

@ -17,7 +17,6 @@
#define _TQ_META_STORE_H_
#include "os.h"
#include "tq.h"
#ifdef __cplusplus

View File

@ -27,10 +27,20 @@ void walClose(SWal *pWal) {}
void walFsync(SWal *pWal, bool force) {}
int64_t walWrite(SWal *pWal, int64_t index, void *body, int32_t bodyLen) {}
int64_t walWrite(SWal *pWal, int64_t index, void *body, int32_t bodyLen) {
return 0;
}
int32_t walCommit(SWal *pWal, int64_t ver) { return 0; }
int32_t walRollback(SWal *pWal, int64_t ver) { return 0; }
int32_t walPrune(SWal *pWal, int64_t ver) { return 0; }
int32_t walRead(SWal *, SWalHead **, int64_t ver);
int32_t walReadWithFp(SWal *, FWalWrite writeFp, int64_t verStart, int32_t readNum);
int64_t walGetFirstVer(SWal *);
int64_t walGetSnapshotVer(SWal *);
int64_t walGetLastVer(SWal *);