tqMetaStore.h 1.7 KB
Newer Older
L
Liu Jicong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _TQ_META_STORE_H_
#define _TQ_META_STORE_H_

#include "os.h"
L
Liu Jicong 已提交
20
#include "tq.h"
L
Liu Jicong 已提交
21 22 23 24 25

#ifdef __cplusplus
extern "C" {
#endif

L
Liu Jicong 已提交
26

L
Liu Jicong 已提交
27
TqMetaStore*  tqStoreOpen(const char* path,
L
Liu Jicong 已提交
28 29 30 31
    TqSerializeFun   pSerializer,
    TqDeserializeFun pDeserializer,
    TqDeleteFun      pDeleter,
    int32_t          tqConfigFlag
L
Liu Jicong 已提交
32
  );
L
Liu Jicong 已提交
33
int32_t       tqStoreClose(TqMetaStore*);
L
Liu Jicong 已提交
34
//int32_t       tqStoreDelete(TqMetaStore*);
L
Liu Jicong 已提交
35
//int32_t       tqStoreCommitAll(TqMetaStore*);
L
Liu Jicong 已提交
36
int32_t       tqStorePersist(TqMetaStore*);
L
Liu Jicong 已提交
37 38
//clean deleted idx and data from persistent file
int32_t       tqStoreCompact(TqMetaStore*);
L
Liu Jicong 已提交
39

L
Liu Jicong 已提交
40
void*   tqHandleGet(TqMetaStore*, int64_t key);
L
Liu Jicong 已提交
41 42
//make it unpersist
void*   tqHandleTouchGet(TqMetaStore*, int64_t key);
L
Liu Jicong 已提交
43 44
int32_t tqHandleMovePut(TqMetaStore*, int64_t key, void* value);
int32_t tqHandleCopyPut(TqMetaStore*, int64_t key, void* value, size_t vsize);
L
Liu Jicong 已提交
45 46
//delete committed kv pair
//notice that a delete action still needs to be committed
L
Liu Jicong 已提交
47
int32_t tqHandleDel(TqMetaStore*, int64_t key);
L
Liu Jicong 已提交
48 49
int32_t tqHandleCommit(TqMetaStore*, int64_t key);
int32_t tqHandleAbort(TqMetaStore*, int64_t key);
L
Liu Jicong 已提交
50 51 52 53 54 55

#ifdef __cplusplus
}
#endif

#endif /* ifndef _TQ_META_STORE_H_ */