refactor tq
This commit is contained in:
parent
ada087b002
commit
4a883c23c5
|
@ -60,8 +60,8 @@ void walClose(twalh);
|
|||
//write
|
||||
int64_t walWrite(twalh, int8_t msgType, void* body, uint32_t bodyLen);
|
||||
void walFsync(twalh, bool forceHint);
|
||||
//int32_t walCommit(twalh, uint64_t ver);
|
||||
//int32_t walRollback(twalh, uint64_t ver);
|
||||
//int32_t walCommit(twalh, int64_t ver);
|
||||
//int32_t walRollback(twalh, int64_t ver);
|
||||
|
||||
//read
|
||||
int32_t walRead(twalh, SWalHead **, int64_t ver);
|
||||
|
|
|
@ -25,23 +25,14 @@ extern "C" {
|
|||
typedef struct STQ STQ;
|
||||
|
||||
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
|
||||
//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);
|
||||
|
||||
int tqPushMsg(STQ*, void *, int64_t version);
|
||||
//void* will be replace by a msg type
|
||||
int tqPushMsg(STQ*, void* msg, int64_t version);
|
||||
int tqCommit(STQ*);
|
||||
|
||||
int tqHandleMsg(STQ*, void *msg);
|
||||
//void* will be replace by a msg type
|
||||
int tqHandleMsg(STQ*, void* msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -25,6 +25,17 @@ extern "C" {
|
|||
//implement the array index
|
||||
//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
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue