提交 4a883c23 编写于 作者: L Liu Jicong

refactor tq

上级 ada087b0
...@@ -60,8 +60,8 @@ void walClose(twalh); ...@@ -60,8 +60,8 @@ void walClose(twalh);
//write //write
int64_t walWrite(twalh, int8_t msgType, void* body, uint32_t bodyLen); int64_t walWrite(twalh, int8_t msgType, void* body, uint32_t bodyLen);
void walFsync(twalh, bool forceHint); void walFsync(twalh, bool forceHint);
//int32_t walCommit(twalh, uint64_t ver); //int32_t walCommit(twalh, int64_t ver);
//int32_t walRollback(twalh, uint64_t ver); //int32_t walRollback(twalh, int64_t ver);
//read //read
int32_t walRead(twalh, SWalHead **, int64_t ver); int32_t walRead(twalh, SWalHead **, int64_t ver);
......
...@@ -25,23 +25,14 @@ extern "C" { ...@@ -25,23 +25,14 @@ extern "C" {
typedef struct STQ STQ; typedef struct STQ STQ;
STQ* tqInit(void* ref_func(void*), void* unref_func(void*)); STQ* tqInit(void* ref_func(void*), void* unref_func(void*));
void tqCleanUp(STQ* pTq); void tqCleanUp(STQ*);
//create persistent storage for meta info such as consuming offset //void* will be replace by a msg type
//return value > 0: cgId int tqPushMsg(STQ*, void* msg, int64_t version);
//return value <= 0: error code
int tqCreateGroup(STQ*);
//create ring buffer in memory and load consuming offset
int tqOpenGroup(STQ*, int cgId);
//destroy ring buffer and persist consuming offset
int tqCloseGroup(STQ*, int cgId);
//delete persistent storage for meta info
int tqDropGroup(STQ*, int cgId);
int tqPushMsg(STQ*, void *, int64_t version);
int tqCommit(STQ*); int tqCommit(STQ*);
int tqHandleMsg(STQ*, void *msg); //void* will be replace by a msg type
int tqHandleMsg(STQ*, void* msg);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -25,6 +25,17 @@ extern "C" { ...@@ -25,6 +25,17 @@ extern "C" {
//implement the array index //implement the array index
//implement the ring buffer //implement the ring buffer
//create persistent storage for meta info such as consuming offset
//return value > 0: cgId
//return value <= 0: error code
int tqCreateGroup(STQ*);
//create ring buffer in memory and load consuming offset
int tqOpenGroup(STQ*, int cgId);
//destroy ring buffer and persist consuming offset
int tqCloseGroup(STQ*, int cgId);
//delete persistent storage for meta info
int tqDropGroup(STQ*, int cgId);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册