more code

This commit is contained in:
Hongze Cheng 2023-04-03 16:15:21 +08:00
parent 7e48fc3ca5
commit 2bab385071
5 changed files with 87 additions and 18 deletions

View File

@ -26,6 +26,8 @@ extern "C" {
#include "tsdbFile.h"
#include "tsdbFileOp.h"
#include "tsdbFS.h"
#include "tsdbSttFWriter.h"

View File

@ -33,6 +33,7 @@ typedef struct {
TSKEY minKey;
TSKEY maxKey;
// writer
SArray *aFileOp;
struct SSttFWriter *pWriter;
} SCommitter;
@ -358,7 +359,7 @@ _exit:
return code;
}
int32_t tsdbCommitRollback(STsdb *pTsdb) {
int32_t tsdbCommitAbort(STsdb *pTsdb) {
int32_t code = 0;
int32_t lino = 0;

View File

@ -15,15 +15,6 @@
#include "dev.h"
typedef enum {
TSDB_FOP_CREATE = -2, // create a file
TSDB_FOP_EXTEND, // extend a file
TSDB_FOP_NONE, // no operation
TSDB_FOP_TRUNCATE, // truncate a file
TSDB_FOP_DELETE, // delete a file
TSDB_FOP_MAX,
} tsdb_fop_t;
const char *tsdb_ftype_suffix[] = {
".head", // TSDB_FTYPE_HEAD
".data", // TSDB_FTYPE_DATA
@ -33,14 +24,6 @@ const char *tsdb_ftype_suffix[] = {
".stt",
};
struct SFileOp {
tsdb_fop_t op;
union {
struct {
} create;
};
};
int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile) {
SVnode *pVnode = pTsdb->pVnode;
STfs *pTfs = pVnode->pTfs;

View File

@ -0,0 +1,45 @@
/*
* 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 _TSDB_FILE_OP_H
#define _TSDB_FILE_OP_H
#ifdef __cplusplus
extern "C" {
#endif
/* Exposed Handle */
typedef enum {
TSDB_FOP_EXTEND = -2,
TSDB_FOP_CREATE,
TSDB_FOP_NONE,
TSDB_FOP_DELETE,
TSDB_FOP_TRUNCATE,
} EFileOpType;
struct SFileOp {
EFileOpType op;
// TODO
};
/* Exposed APIs */
/* Exposed Structs */
#ifdef __cplusplus
}
#endif
#endif /*_TSDB_FILE_OP_H*/

View File

@ -0,0 +1,38 @@
/*
* 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/>.
*/
#include "dev.h"
typedef struct {
STsdb *pTsdb;
} SMerger;
int32_t tsdbMergeBegin(STsdb *pTsdb) {
int32_t code = 0;
// TODO
return code;
}
int32_t tsdbMergeCommit(STsdb *pTsdb) {
int32_t code = 0;
// TODO
return code;
}
int32_t tsdbMergeAbort(STsdb *pTsdb) {
int32_t code = 0;
// TODO
return code;
}