2023-04-03 06:31:37 +00:00
|
|
|
/*
|
|
|
|
|
* 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 _STREAM_FILE_STATE_H_
|
|
|
|
|
#define _STREAM_FILE_STATE_H_
|
|
|
|
|
|
|
|
|
|
#include "os.h"
|
|
|
|
|
|
2023-04-12 03:03:51 +00:00
|
|
|
#include "tarray.h"
|
2023-04-03 06:31:37 +00:00
|
|
|
#include "tdef.h"
|
|
|
|
|
#include "tlist.h"
|
2023-05-23 10:29:23 +00:00
|
|
|
#include "storageapi.h"
|
2023-04-03 06:31:37 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef struct SStreamFileState SStreamFileState;
|
|
|
|
|
typedef SList SStreamSnapshot;
|
|
|
|
|
|
2023-05-15 08:26:24 +00:00
|
|
|
SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, uint32_t selectRowSize,
|
2023-06-08 10:59:25 +00:00
|
|
|
GetTsFun fp, void* pFile, TSKEY delMark, const char* id);
|
2023-04-04 09:08:24 +00:00
|
|
|
void streamFileStateDestroy(SStreamFileState* pFileState);
|
|
|
|
|
void streamFileStateClear(SStreamFileState* pFileState);
|
2023-04-26 10:58:19 +00:00
|
|
|
bool needClearDiskBuff(SStreamFileState* pFileState);
|
2023-04-03 06:31:37 +00:00
|
|
|
|
|
|
|
|
int32_t getRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen);
|
2023-04-04 09:08:24 +00:00
|
|
|
int32_t deleteRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t keyLen);
|
|
|
|
|
int32_t getRowBuffByPos(SStreamFileState* pFileState, SRowBuffPos* pPos, void** pVal);
|
2023-04-12 03:03:51 +00:00
|
|
|
void releaseRowBuffPos(SRowBuffPos* pBuff);
|
|
|
|
|
bool hasRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen);
|
2023-04-03 06:31:37 +00:00
|
|
|
|
|
|
|
|
SStreamSnapshot* getSnapshot(SStreamFileState* pFileState);
|
2023-04-12 03:03:51 +00:00
|
|
|
int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot, bool flushState);
|
|
|
|
|
int32_t recoverSnapshot(SStreamFileState* pFileState);
|
|
|
|
|
|
|
|
|
|
int32_t getSnapshotIdList(SStreamFileState* pFileState, SArray* list);
|
2023-04-12 09:33:58 +00:00
|
|
|
int32_t deleteExpiredCheckPoint(SStreamFileState* pFileState, TSKEY mark);
|
2023-05-15 08:26:24 +00:00
|
|
|
int32_t streamFileStateGeSelectRowSize(SStreamFileState* pFileState);
|
2023-06-15 06:13:17 +00:00
|
|
|
void streamFileStateReloadInfo(SStreamFileState* pFileState, TSKEY ts);
|
2023-04-03 06:31:37 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // _STREAM_FILE_STATE_H_
|