mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-04 09:52:30 +08:00
Related to #39095 https://go.dev/doc/modules/version-numbers Update pkg version according to golang dep version convention --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
package timetick
|
|
|
|
import (
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
|
|
"github.com/milvus-io/milvus/pkg/v2/streaming/util/message"
|
|
"github.com/milvus-io/milvus/pkg/v2/util/commonpbutil"
|
|
)
|
|
|
|
func NewTimeTickMsg(ts uint64, lastConfirmedMessageID message.MessageID, sourceID int64) (message.MutableMessage, error) {
|
|
// TODO: time tick should be put on properties, for compatibility, we put it on message body now.
|
|
// Common message's time tick is set on interceptor.
|
|
// TimeTickMsg's time tick should be set here.
|
|
msg, err := message.NewTimeTickMessageBuilderV1().
|
|
WithHeader(&message.TimeTickMessageHeader{}).
|
|
WithBody(&msgpb.TimeTickMsg{
|
|
Base: commonpbutil.NewMsgBase(
|
|
commonpbutil.WithMsgType(commonpb.MsgType_TimeTick),
|
|
commonpbutil.WithMsgID(0),
|
|
commonpbutil.WithTimeStamp(ts),
|
|
commonpbutil.WithSourceID(sourceID),
|
|
),
|
|
}).
|
|
WithAllVChannel().
|
|
BuildMutable()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if lastConfirmedMessageID != nil {
|
|
return msg.WithTimeTick(ts).WithLastConfirmed(lastConfirmedMessageID), nil
|
|
}
|
|
return msg.WithTimeTick(ts).WithLastConfirmedUseMessageID(), nil
|
|
}
|