提交 e42f0280 编写于 作者: L Liu Jicong

refine tq meta interface

上级 6d55ee00
......@@ -61,19 +61,15 @@ int32_t tqStoreClose(TqMetaStore*);
//int32_t TqStoreCommitAll(TqMetaStore*);
int32_t tqStorePersist(TqMetaStore*);
TqMetaHandle* tqHandleGetInUse(TqMetaStore*, int64_t key);
int32_t tqHandlePutInUse(TqMetaStore*, int64_t key, void* value);
TqMetaHandle* tqHandleGetInTxn(TqMetaStore*, int64_t key);
int32_t tqHandlePutInTxn(TqMetaStore*, int64_t key, void* value);
//will replace old handle
//int32_t tqHandlePut(TqMetaStore*, TqMetaHandle* handle);
//delete in-use-handle, and put it in use
TqMetaHandle* tqHandleGet(TqMetaStore*, int64_t key);
int32_t tqHandlePut(TqMetaStore*, int64_t key, void* value);
//do commit
int32_t tqHandleCommit(TqMetaStore*, int64_t key);
//delete in-txn-handle
//delete uncommitted
int32_t tqHandleAbort(TqMetaStore*, int64_t key);
//delete in-use-handle
//delete committed
int32_t tqHandleDel(TqMetaStore*, int64_t key);
//delete in-use-handle and in-txn-handle
//delete both committed and uncommitted
int32_t tqHandleClear(TqMetaStore*, int64_t key);
#ifdef __cplusplus
......
......@@ -22,6 +22,10 @@
#define TQ_META_NAME "tq.meta"
#define TQ_IDX_NAME "tq.idx"
static int32_t tqHandlePutCommitted(TqMetaStore*, int64_t key, void* value);
static TqMetaHandle* tqHandleGetUncommitted(TqMetaStore*, int64_t key);
typedef struct TqMetaPageBuf {
int16_t offset;
char buffer[TQ_PAGE_SIZE];
......@@ -138,7 +142,7 @@ int32_t tqStorePersist(TqMetaStore* pMeta) {
return 0;
}
int32_t tqHandlePutInUse(TqMetaStore* pMeta, int64_t key, void* value) {
static int32_t tqHandlePutCommitted(TqMetaStore* pMeta, int64_t key, void* value) {
int64_t bucketKey = key & TQ_BUCKET_SIZE;
TqMetaList* pNode = pMeta->bucket[bucketKey];
while(pNode) {
......@@ -154,7 +158,7 @@ int32_t tqHandlePutInUse(TqMetaStore* pMeta, int64_t key, void* value) {
return 0;
}
TqMetaHandle* tqHandleGetInUse(TqMetaStore* pMeta, int64_t key) {
TqMetaHandle* tqHandleGet(TqMetaStore* pMeta, int64_t key) {
int64_t bucketKey = key & TQ_BUCKET_SIZE;
TqMetaList* pNode = pMeta->bucket[bucketKey];
while(pNode) {
......@@ -171,7 +175,7 @@ TqMetaHandle* tqHandleGetInUse(TqMetaStore* pMeta, int64_t key) {
return NULL;
}
int32_t tqHandlePutInTxn(TqMetaStore* pMeta, int64_t key, void* value) {
int32_t tqHandlePut(TqMetaStore* pMeta, int64_t key, void* value) {
int64_t bucketKey = key & TQ_BUCKET_SIZE;
TqMetaList* pNode = pMeta->bucket[bucketKey];
while(pNode) {
......@@ -187,7 +191,7 @@ int32_t tqHandlePutInTxn(TqMetaStore* pMeta, int64_t key, void* value) {
return 0;
}
TqMetaHandle* tqHandleGetInTxn(TqMetaStore* pMeta, int64_t key) {
static TqMetaHandle* tqHandleGetUncommitted(TqMetaStore* pMeta, int64_t key) {
int64_t bucketKey = key & TQ_BUCKET_SIZE;
TqMetaList* pNode = pMeta->bucket[bucketKey];
while(pNode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册