format code style

This commit is contained in:
yihaoDeng 2021-12-22 09:02:48 +08:00
parent 10b70175b5
commit ecc435803f
3 changed files with 34 additions and 19 deletions

View File

@ -76,8 +76,13 @@ void indexOptsDestroy(SIndexOpts *opts);
* @param: * @param:
*/ */
SIndexTerm *indexTermCreate(int64_t suid, SIndexOperOnColumn operType, uint8_t colType, const char *colName, SIndexTerm* indexTermCreate(int64_t suid,
int32_t nColName, const char *colVal, int32_t nColVal); SIndexOperOnColumn operType,
uint8_t colType,
const char* colName,
int32_t nColName,
const char* colVal,
int32_t nColVal);
void indexTermDestroy(SIndexTerm* p); void indexTermDestroy(SIndexTerm* p);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -60,6 +60,7 @@ typedef struct TFileWriter {
FstBuilder* fb; FstBuilder* fb;
WriterCtx* ctx; WriterCtx* ctx;
TFileHeader header; TFileHeader header;
uint32_t offset;
} TFileWriter; } TFileWriter;
typedef struct TFileReader { typedef struct TFileReader {
@ -101,7 +102,7 @@ int tfileReaderSearch(TFileReader* reader, SIndexTermQuery* query, SArr
TFileWriter* tfileWriterCreate(WriterCtx* ctx, TFileHeader* header); TFileWriter* tfileWriterCreate(WriterCtx* ctx, TFileHeader* header);
void tfileWriterDestroy(TFileWriter* tw); void tfileWriterDestroy(TFileWriter* tw);
int tfileWriterPut(TFileWriter* tw, const char* key, int32_t nKey, const char* val, int32_t nVal); int tfileWriterPut(TFileWriter* tw, void* data);
int tfileWriterFinish(TFileWriter* tw); int tfileWriterFinish(TFileWriter* tw);
// //

View File

@ -36,6 +36,8 @@ static FORCE_INLINE int tfileWriteHeader(TFileWriter* writer) {
int offset = p - buf; int offset = p - buf;
int nwrite = writer->ctx->write(writer->ctx, buf, offset); int nwrite = writer->ctx->write(writer->ctx, buf, offset);
if (offset != nwrite) { return -1; } if (offset != nwrite) { return -1; }
writer->offset = offset;
return 0;
} }
static FORCE_INLINE int tfileReadLoadHeader(TFileReader* reader) { static FORCE_INLINE int tfileReadLoadHeader(TFileReader* reader) {
// TODO simple tfile header later // TODO simple tfile header later
@ -238,9 +240,16 @@ TFileWriter* tfileWriterCreate(WriterCtx* ctx, TFileHeader* header) {
} }
tw->ctx = ctx; tw->ctx = ctx;
tw->header = *header; tw->header = *header;
tfileWriteHeader(tw);
return tw; return tw;
} }
int TFileWriterPut(TFileWriter* tw, void* data) {
int32_t sz = taosArrayGetSize((SArray*)data);
// sort by and write to
return 0;
}
void tfileWriterDestroy(TFileWriter* tw) { void tfileWriterDestroy(TFileWriter* tw) {
if (tw == NULL) { return; } if (tw == NULL) { return; }