feat: code optimization
This commit is contained in:
parent
9e7b43c836
commit
fa77a6d840
|
@ -2256,48 +2256,48 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int idx;
|
int idx;
|
||||||
} SMCreateFullTextReq;
|
} SMCreateFullTextReq;
|
||||||
|
|
||||||
int32_t tSerializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
|
int32_t tSerializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
|
||||||
int32_t tDeserializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
|
int32_t tDeserializeSMCreateFullTextReq(void* buf, int32_t bufLen, SMCreateFullTextReq* pReq);
|
||||||
void tFreeSMCreateFullTextReq(SMCreateFullTextReq * pReq);
|
void tFreeSMCreateFullTextReq(SMCreateFullTextReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_TABLE_FNAME_LEN];
|
char name[TSDB_TABLE_FNAME_LEN];
|
||||||
int8_t igNotExists;
|
int8_t igNotExists;
|
||||||
} SMDropFullTextReq;
|
} SMDropFullTextReq;
|
||||||
|
|
||||||
int32_t tSerializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
|
int32_t tSerializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
|
||||||
int32_t tDeserializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
|
int32_t tDeserializeSMDropFullTextReq(void* buf, int32_t bufLen, SMDropFullTextReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char indexFName[TSDB_INDEX_FNAME_LEN];
|
char indexFName[TSDB_INDEX_FNAME_LEN];
|
||||||
} SUserIndexReq;
|
} SUserIndexReq;
|
||||||
|
|
||||||
int32_t tSerializeSUserIndexReq(void* buf, int32_t bufLen, SUserIndexReq* pReq);
|
int32_t tSerializeSUserIndexReq(void* buf, int32_t bufLen, SUserIndexReq* pReq);
|
||||||
int32_t tDeserializeSUserIndexReq(void* buf, int32_t bufLen, SUserIndexReq* pReq);
|
int32_t tDeserializeSUserIndexReq(void* buf, int32_t bufLen, SUserIndexReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char dbFName[TSDB_DB_FNAME_LEN];
|
char dbFName[TSDB_DB_FNAME_LEN];
|
||||||
char tblFName[TSDB_TABLE_FNAME_LEN];
|
char tblFName[TSDB_TABLE_FNAME_LEN];
|
||||||
char colName[TSDB_COL_NAME_LEN];
|
char colName[TSDB_COL_NAME_LEN];
|
||||||
char indexType[TSDB_INDEX_TYPE_LEN];
|
char indexType[TSDB_INDEX_TYPE_LEN];
|
||||||
char indexExts[TSDB_INDEX_EXTS_LEN];
|
char indexExts[TSDB_INDEX_EXTS_LEN];
|
||||||
} SUserIndexRsp;
|
} SUserIndexRsp;
|
||||||
|
|
||||||
int32_t tSerializeSUserIndexRsp(void* buf, int32_t bufLen, const SUserIndexRsp* pRsp);
|
int32_t tSerializeSUserIndexRsp(void* buf, int32_t bufLen, const SUserIndexRsp* pRsp);
|
||||||
int32_t tDeserializeSUserIndexRsp(void* buf, int32_t bufLen, SUserIndexRsp* pRsp);
|
int32_t tDeserializeSUserIndexRsp(void* buf, int32_t bufLen, SUserIndexRsp* pRsp);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t mqMsgType;
|
int8_t mqMsgType;
|
||||||
int32_t code;
|
int32_t code;
|
||||||
int32_t epoch;
|
int32_t epoch;
|
||||||
int64_t consumerId;
|
int64_t consumerId;
|
||||||
} SMqRspHead;
|
} SMqRspHead;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SMsgHead head;
|
SMsgHead head;
|
||||||
char subKey[TSDB_SUBSCRIBE_KEY_LEN];
|
char subKey[TSDB_SUBSCRIBE_KEY_LEN];
|
||||||
int8_t withTbName;
|
int8_t withTbName;
|
||||||
|
@ -2306,37 +2306,37 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
int64_t consumerId;
|
int64_t consumerId;
|
||||||
int64_t waitTime;
|
int64_t waitTime;
|
||||||
int64_t currentOffset;
|
int64_t currentOffset;
|
||||||
} SMqPollReq;
|
} SMqPollReq;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
int64_t offset;
|
int64_t offset;
|
||||||
SEpSet epSet;
|
SEpSet epSet;
|
||||||
} SMqSubVgEp;
|
} SMqSubVgEp;
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tEncodeSMqSubVgEp(void** buf, const SMqSubVgEp* pVgEp) {
|
static FORCE_INLINE int32_t tEncodeSMqSubVgEp(void** buf, const SMqSubVgEp* pVgEp) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
tlen += taosEncodeFixedI32(buf, pVgEp->vgId);
|
tlen += taosEncodeFixedI32(buf, pVgEp->vgId);
|
||||||
tlen += taosEncodeFixedI64(buf, pVgEp->offset);
|
tlen += taosEncodeFixedI64(buf, pVgEp->offset);
|
||||||
tlen += taosEncodeSEpSet(buf, &pVgEp->epSet);
|
tlen += taosEncodeSEpSet(buf, &pVgEp->epSet);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void* tDecodeSMqSubVgEp(void* buf, SMqSubVgEp* pVgEp) {
|
static FORCE_INLINE void* tDecodeSMqSubVgEp(void* buf, SMqSubVgEp* pVgEp) {
|
||||||
buf = taosDecodeFixedI32(buf, &pVgEp->vgId);
|
buf = taosDecodeFixedI32(buf, &pVgEp->vgId);
|
||||||
buf = taosDecodeFixedI64(buf, &pVgEp->offset);
|
buf = taosDecodeFixedI64(buf, &pVgEp->offset);
|
||||||
buf = taosDecodeSEpSet(buf, &pVgEp->epSet);
|
buf = taosDecodeSEpSet(buf, &pVgEp->epSet);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char topic[TSDB_TOPIC_FNAME_LEN];
|
char topic[TSDB_TOPIC_FNAME_LEN];
|
||||||
int8_t isSchemaAdaptive;
|
int8_t isSchemaAdaptive;
|
||||||
SArray* vgs; // SArray<SMqSubVgEp>
|
SArray* vgs; // SArray<SMqSubVgEp>
|
||||||
SSchemaWrapper schema;
|
SSchemaWrapper schema;
|
||||||
} SMqSubTopicEp;
|
} SMqSubTopicEp;
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tEncodeSMqSubTopicEp(void** buf, const SMqSubTopicEp* pTopicEp) {
|
static FORCE_INLINE int32_t tEncodeSMqSubTopicEp(void** buf, const SMqSubTopicEp* pTopicEp) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
tlen += taosEncodeString(buf, pTopicEp->topic);
|
tlen += taosEncodeString(buf, pTopicEp->topic);
|
||||||
tlen += taosEncodeFixedI8(buf, pTopicEp->isSchemaAdaptive);
|
tlen += taosEncodeFixedI8(buf, pTopicEp->isSchemaAdaptive);
|
||||||
|
@ -2348,9 +2348,9 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
}
|
}
|
||||||
tlen += taosEncodeSSchemaWrapper(buf, &pTopicEp->schema);
|
tlen += taosEncodeSSchemaWrapper(buf, &pTopicEp->schema);
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void* tDecodeSMqSubTopicEp(void* buf, SMqSubTopicEp* pTopicEp) {
|
static FORCE_INLINE void* tDecodeSMqSubTopicEp(void* buf, SMqSubTopicEp* pTopicEp) {
|
||||||
buf = taosDecodeStringTo(buf, pTopicEp->topic);
|
buf = taosDecodeStringTo(buf, pTopicEp->topic);
|
||||||
buf = taosDecodeFixedI8(buf, &pTopicEp->isSchemaAdaptive);
|
buf = taosDecodeFixedI8(buf, &pTopicEp->isSchemaAdaptive);
|
||||||
int32_t sz;
|
int32_t sz;
|
||||||
|
@ -2366,14 +2366,14 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
}
|
}
|
||||||
buf = taosDecodeSSchemaWrapper(buf, &pTopicEp->schema);
|
buf = taosDecodeSSchemaWrapper(buf, &pTopicEp->schema);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void tDeleteSMqSubTopicEp(SMqSubTopicEp * pSubTopicEp) {
|
static FORCE_INLINE void tDeleteSMqSubTopicEp(SMqSubTopicEp* pSubTopicEp) {
|
||||||
// taosMemoryFree(pSubTopicEp->schema.pSchema);
|
// taosMemoryFree(pSubTopicEp->schema.pSchema);
|
||||||
taosArrayDestroy(pSubTopicEp->vgs);
|
taosArrayDestroy(pSubTopicEp->vgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SMqRspHead head;
|
SMqRspHead head;
|
||||||
int64_t reqOffset;
|
int64_t reqOffset;
|
||||||
int64_t rspOffset;
|
int64_t rspOffset;
|
||||||
|
@ -2388,9 +2388,9 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
SArray* blockSchema; // SArray<SSchemaWrapper>
|
SArray* blockSchema; // SArray<SSchemaWrapper>
|
||||||
SArray* blockTags; // SArray<kvrow>
|
SArray* blockTags; // SArray<kvrow>
|
||||||
SArray* blockTagSchema; // SArray<kvrow>
|
SArray* blockTagSchema; // SArray<kvrow>
|
||||||
} SMqDataBlkRsp;
|
} SMqDataBlkRsp;
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tEncodeSMqDataBlkRsp(void** buf, const SMqDataBlkRsp* pRsp) {
|
static FORCE_INLINE int32_t tEncodeSMqDataBlkRsp(void** buf, const SMqDataBlkRsp* pRsp) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
tlen += taosEncodeFixedI64(buf, pRsp->reqOffset);
|
tlen += taosEncodeFixedI64(buf, pRsp->reqOffset);
|
||||||
tlen += taosEncodeFixedI64(buf, pRsp->rspOffset);
|
tlen += taosEncodeFixedI64(buf, pRsp->rspOffset);
|
||||||
|
@ -2417,9 +2417,9 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void* tDecodeSMqDataBlkRsp(const void* buf, SMqDataBlkRsp* pRsp) {
|
static FORCE_INLINE void* tDecodeSMqDataBlkRsp(const void* buf, SMqDataBlkRsp* pRsp) {
|
||||||
buf = taosDecodeFixedI64(buf, &pRsp->reqOffset);
|
buf = taosDecodeFixedI64(buf, &pRsp->reqOffset);
|
||||||
buf = taosDecodeFixedI64(buf, &pRsp->rspOffset);
|
buf = taosDecodeFixedI64(buf, &pRsp->rspOffset);
|
||||||
buf = taosDecodeFixedI32(buf, &pRsp->skipLogNum);
|
buf = taosDecodeFixedI32(buf, &pRsp->skipLogNum);
|
||||||
|
@ -2453,15 +2453,15 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (void*)buf;
|
return (void*)buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SMqRspHead head;
|
SMqRspHead head;
|
||||||
char cgroup[TSDB_CGROUP_LEN];
|
char cgroup[TSDB_CGROUP_LEN];
|
||||||
SArray* topics; // SArray<SMqSubTopicEp>
|
SArray* topics; // SArray<SMqSubTopicEp>
|
||||||
} SMqAskEpRsp;
|
} SMqAskEpRsp;
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tEncodeSMqAskEpRsp(void** buf, const SMqAskEpRsp* pRsp) {
|
static FORCE_INLINE int32_t tEncodeSMqAskEpRsp(void** buf, const SMqAskEpRsp* pRsp) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
// tlen += taosEncodeString(buf, pRsp->cgroup);
|
// tlen += taosEncodeString(buf, pRsp->cgroup);
|
||||||
int32_t sz = taosArrayGetSize(pRsp->topics);
|
int32_t sz = taosArrayGetSize(pRsp->topics);
|
||||||
|
@ -2471,9 +2471,9 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
tlen += tEncodeSMqSubTopicEp(buf, pVgEp);
|
tlen += tEncodeSMqSubTopicEp(buf, pVgEp);
|
||||||
}
|
}
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void* tDecodeSMqAskEpRsp(void* buf, SMqAskEpRsp* pRsp) {
|
static FORCE_INLINE void* tDecodeSMqAskEpRsp(void* buf, SMqAskEpRsp* pRsp) {
|
||||||
// buf = taosDecodeStringTo(buf, pRsp->cgroup);
|
// buf = taosDecodeStringTo(buf, pRsp->cgroup);
|
||||||
int32_t sz;
|
int32_t sz;
|
||||||
buf = taosDecodeFixedI32(buf, &sz);
|
buf = taosDecodeFixedI32(buf, &sz);
|
||||||
|
@ -2487,11 +2487,11 @@ static int32_t tDecodeTSmaWrapper(SDecoder* pDecoder, STSmaWrapper* pReq) {
|
||||||
taosArrayPush(pRsp->topics, &topicEp);
|
taosArrayPush(pRsp->topics, &topicEp);
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void tDeleteSMqAskEpRsp(SMqAskEpRsp * pRsp) {
|
static FORCE_INLINE void tDeleteSMqAskEpRsp(SMqAskEpRsp* pRsp) {
|
||||||
taosArrayDestroyEx(pRsp->topics, (void (*)(void*))tDeleteSMqSubTopicEp);
|
taosArrayDestroyEx(pRsp->topics, (void (*)(void*))tDeleteSMqSubTopicEp);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void* data;
|
void* data;
|
||||||
|
|
Loading…
Reference in New Issue