feat: add vgroup and epset in tsma info
This commit is contained in:
parent
47bf6a5aa1
commit
8a3594dd8c
|
@ -2296,6 +2296,11 @@ typedef struct {
|
||||||
int32_t tSerializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
|
int32_t tSerializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
|
||||||
int32_t tDeserializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
|
int32_t tDeserializeSMDropSmaReq(void* buf, int32_t bufLen, SMDropSmaReq* pReq);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t vgId;
|
||||||
|
SEpSet epSet;
|
||||||
|
} SVgEpSet;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t version; // for compatibility(default 0)
|
int8_t version; // for compatibility(default 0)
|
||||||
int8_t intervalUnit; // MACRO: TIME_UNIT_XXX
|
int8_t intervalUnit; // MACRO: TIME_UNIT_XXX
|
||||||
|
@ -2305,6 +2310,7 @@ typedef struct {
|
||||||
char indexName[TSDB_INDEX_NAME_LEN];
|
char indexName[TSDB_INDEX_NAME_LEN];
|
||||||
int32_t exprLen;
|
int32_t exprLen;
|
||||||
int32_t tagsFilterLen;
|
int32_t tagsFilterLen;
|
||||||
|
int32_t numOfVgroups;
|
||||||
int64_t indexUid;
|
int64_t indexUid;
|
||||||
tb_uid_t tableUid; // super/child/common table uid
|
tb_uid_t tableUid; // super/child/common table uid
|
||||||
int64_t interval;
|
int64_t interval;
|
||||||
|
@ -2312,6 +2318,7 @@ typedef struct {
|
||||||
int64_t sliding;
|
int64_t sliding;
|
||||||
char* expr; // sma expression
|
char* expr; // sma expression
|
||||||
char* tagsFilter;
|
char* tagsFilter;
|
||||||
|
SVgEpSet vgEpSet[];
|
||||||
} STSma; // Time-range-wise SMA
|
} STSma; // Time-range-wise SMA
|
||||||
|
|
||||||
typedef STSma SVCreateTSmaReq;
|
typedef STSma SVCreateTSmaReq;
|
||||||
|
|
|
@ -3661,6 +3661,7 @@ int32_t tEncodeTSma(SEncoder *pCoder, const STSma *pSma) {
|
||||||
if (tEncodeCStr(pCoder, pSma->indexName) < 0) return -1;
|
if (tEncodeCStr(pCoder, pSma->indexName) < 0) return -1;
|
||||||
if (tEncodeI32(pCoder, pSma->exprLen) < 0) return -1;
|
if (tEncodeI32(pCoder, pSma->exprLen) < 0) return -1;
|
||||||
if (tEncodeI32(pCoder, pSma->tagsFilterLen) < 0) return -1;
|
if (tEncodeI32(pCoder, pSma->tagsFilterLen) < 0) return -1;
|
||||||
|
if (tEncodeI32(pCoder, pSma->numOfVgroups) < 0) return -1;
|
||||||
if (tEncodeI64(pCoder, pSma->indexUid) < 0) return -1;
|
if (tEncodeI64(pCoder, pSma->indexUid) < 0) return -1;
|
||||||
if (tEncodeI64(pCoder, pSma->tableUid) < 0) return -1;
|
if (tEncodeI64(pCoder, pSma->tableUid) < 0) return -1;
|
||||||
if (tEncodeI64(pCoder, pSma->interval) < 0) return -1;
|
if (tEncodeI64(pCoder, pSma->interval) < 0) return -1;
|
||||||
|
@ -3672,7 +3673,17 @@ int32_t tEncodeTSma(SEncoder *pCoder, const STSma *pSma) {
|
||||||
if (pSma->tagsFilterLen > 0) {
|
if (pSma->tagsFilterLen > 0) {
|
||||||
if (tEncodeCStr(pCoder, pSma->tagsFilter) < 0) return -1;
|
if (tEncodeCStr(pCoder, pSma->tagsFilter) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
for (int32_t v = 0; v < pSma->numOfVgroups; ++v) {
|
||||||
|
if (tEncodeI32(pCoder, pSma->vgEpSet[v].vgId) < 0) return -1;
|
||||||
|
if (tEncodeI8(pCoder, pSma->vgEpSet[v].epSet.inUse) < 0) return -1;
|
||||||
|
int8_t numOfEps = pSma->vgEpSet[v].epSet.numOfEps;
|
||||||
|
if (tEncodeI8(pCoder, numOfEps) < 0) return -1;
|
||||||
|
for (int32_t n = 0; n < numOfEps; ++n) {
|
||||||
|
const SEp *pEp = &pSma->vgEpSet[v].epSet.eps[n];
|
||||||
|
if (tEncodeCStr(pCoder, pEp->fqdn) < 0) return -1;
|
||||||
|
if (tEncodeU16(pCoder, pEp->port) < 0) return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3685,6 +3696,7 @@ int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma) {
|
||||||
if (tDecodeCStrTo(pCoder, pSma->indexName) < 0) return -1;
|
if (tDecodeCStrTo(pCoder, pSma->indexName) < 0) return -1;
|
||||||
if (tDecodeI32(pCoder, &pSma->exprLen) < 0) return -1;
|
if (tDecodeI32(pCoder, &pSma->exprLen) < 0) return -1;
|
||||||
if (tDecodeI32(pCoder, &pSma->tagsFilterLen) < 0) return -1;
|
if (tDecodeI32(pCoder, &pSma->tagsFilterLen) < 0) return -1;
|
||||||
|
if (tDecodeI32(pCoder, &pSma->numOfVgroups) < 0) return -1;
|
||||||
if (tDecodeI64(pCoder, &pSma->indexUid) < 0) return -1;
|
if (tDecodeI64(pCoder, &pSma->indexUid) < 0) return -1;
|
||||||
if (tDecodeI64(pCoder, &pSma->tableUid) < 0) return -1;
|
if (tDecodeI64(pCoder, &pSma->tableUid) < 0) return -1;
|
||||||
if (tDecodeI64(pCoder, &pSma->interval) < 0) return -1;
|
if (tDecodeI64(pCoder, &pSma->interval) < 0) return -1;
|
||||||
|
@ -3700,6 +3712,17 @@ int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma) {
|
||||||
} else {
|
} else {
|
||||||
pSma->tagsFilter = NULL;
|
pSma->tagsFilter = NULL;
|
||||||
}
|
}
|
||||||
|
for (int32_t v = 0; v < pSma->numOfVgroups; ++v) {
|
||||||
|
if (tDecodeI32(pCoder, &pSma->vgEpSet[v].vgId) < 0) return -1;
|
||||||
|
if (tDecodeI8(pCoder, &pSma->vgEpSet[v].epSet.inUse) < 0) return -1;
|
||||||
|
if (tDecodeI8(pCoder, &pSma->vgEpSet[v].epSet.numOfEps) < 0) return -1;
|
||||||
|
int8_t numOfEps = pSma->vgEpSet[v].epSet.numOfEps;
|
||||||
|
for (int32_t n = 0; n < numOfEps; ++n) {
|
||||||
|
SEp *pEp = &pSma->vgEpSet[v].epSet.eps[n];
|
||||||
|
if (tDecodeCStrTo(pCoder, pEp->fqdn) < 0) return -1;
|
||||||
|
if (tDecodeU16(pCoder, &pEp->port) < 0) return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue