more code

This commit is contained in:
Hongze Cheng 2023-04-11 17:04:52 +08:00
parent 2b48df0ba4
commit 8d7055b123
4 changed files with 27 additions and 10 deletions

View File

@ -345,25 +345,33 @@ static int32_t close_file_system(struct STFileSystem *pFS) {
return 0; return 0;
} }
static int32_t read_fs_from_file(struct STFileSystem *pFS, const char *fname) { static int32_t apply_edit(struct STFileSystem *pFS) {
int32_t code = 0;
ASSERTS(0, "TODO: Not implemented yet"); ASSERTS(0, "TODO: Not implemented yet");
return 0; return code;
} }
static int32_t edit_fs(struct STFileSystem *pFS, const SArray *aFileOp) { static int32_t edit_fs(struct STFileSystem *pFS, const SArray *aFileOp) {
int32_t code = 0;
int32_t lino;
ASSERTS(0, "TODO: Not implemented yet"); ASSERTS(0, "TODO: Not implemented yet");
taosArrayClearEx(pFS->nState, NULL /* TODO */);
// TODO: copy current state to new state
for (int32_t iop = 0; iop < taosArrayGetSize(aFileOp); iop++) { for (int32_t iop = 0; iop < taosArrayGetSize(aFileOp); iop++) {
struct SFileOp *pOp = taosArrayGet(aFileOp, iop); struct SFileOp *pOp = taosArrayGet(aFileOp, iop);
// if (pOp->op == TSDB_FS_OP_ADD) {
// ASSERTS(0, "TODO: Not implemented yet"); struct SFileSet *pSet = taosArraySearch(pFS->nState, NULL /* TODO */, NULL /* TODO */, TD_EQ);
// } else if (pOp->op == TSDB_FS_OP_DEL) { TSDB_CHECK_CODE( //
// ASSERTS(0, "TODO: Not implemented yet"); code = tsdbEditFileSet(pSet, pOp), //
// } else { lino, //
// ASSERTS(0, "TODO: Not implemented yet"); _exit);
// }
} }
_exit:
return 0; return 0;
} }

View File

@ -24,7 +24,8 @@ extern "C" {
/* Exposed Handle */ /* Exposed Handle */
struct STFileSystem { struct STFileSystem {
STsdb *pTsdb; STsdb *pTsdb;
// int32_t state; // TODO
tsem_t canEdit; tsem_t canEdit;
int64_t nextEditId; int64_t nextEditId;
SArray *aFileSet; // SArray<struct SFileSet> SArray *aFileSet; // SArray<struct SFileSet>

View File

@ -22,4 +22,11 @@ int32_t tsdbFileSetToJson(SJson *pJson, const struct SFileSet *pSet) {
_exit: _exit:
return code; return code;
}
int32_t tsdbEditFileSet(struct SFileSet *pFileSet, const struct SFileOp *pOp) {
int32_t code = 0;
ASSERTS(0, "TODO: Not implemented yet");
// TODO
return code;
} }

View File

@ -53,6 +53,7 @@ struct SFileSet {
}; };
int32_t tsdbFileSetToJson(SJson *pJson, const struct SFileSet *pSet); int32_t tsdbFileSetToJson(SJson *pJson, const struct SFileSet *pSet);
int32_t tsdbEditFileSet(struct SFileSet *pFileSet, const struct SFileOp *pOp);
#ifdef __cplusplus #ifdef __cplusplus
} }