mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
1aafe86ffe
Signed-off-by: XuanYang-cn <xuan.yang@zilliz.com>
33 lines
718 B
Go
33 lines
718 B
Go
package dataservice
|
|
|
|
import (
|
|
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
|
|
)
|
|
|
|
type statsHandler struct {
|
|
meta *meta
|
|
}
|
|
|
|
func newStatsHandler(meta *meta) *statsHandler {
|
|
return &statsHandler{
|
|
meta: meta,
|
|
}
|
|
}
|
|
|
|
func (handler *statsHandler) HandleSegmentStat(segStats *internalpb2.SegmentStatisticsUpdates) error {
|
|
segMeta, err := handler.meta.GetSegment(segStats.SegmentID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if segStats.IsNewSegment {
|
|
segMeta.OpenTime = segStats.CreateTime
|
|
segMeta.StartPosition = segStats.StartPosition
|
|
}
|
|
segMeta.SealedTime = segStats.EndTime
|
|
segMeta.NumRows = segStats.NumRows
|
|
segMeta.MemSize = segStats.MemorySize
|
|
|
|
return handler.meta.UpdateSegment(segMeta)
|
|
}
|