2020-11-02 16:44:54 +08:00
|
|
|
package flowgraph
|
|
|
|
|
2020-11-09 16:27:11 +08:00
|
|
|
import "github.com/zilliztech/milvus-distributed/internal/msgstream"
|
|
|
|
|
2020-11-02 16:44:54 +08:00
|
|
|
type Msg interface {
|
|
|
|
TimeTick() Timestamp
|
|
|
|
}
|
2020-11-09 16:27:11 +08:00
|
|
|
|
|
|
|
type MsgStreamMsg struct {
|
2021-01-26 09:44:39 +08:00
|
|
|
tsMessages []msgstream.TsMsg
|
|
|
|
timestampMin Timestamp
|
|
|
|
timestampMax Timestamp
|
|
|
|
startPositions []*MsgPosition
|
2021-03-16 17:55:42 +08:00
|
|
|
endPositions []*MsgPosition
|
2020-11-09 16:27:11 +08:00
|
|
|
}
|
|
|
|
|
2021-03-16 17:55:42 +08:00
|
|
|
func GenerateMsgStreamMsg(tsMessages []msgstream.TsMsg, timestampMin, timestampMax Timestamp, startPos []*MsgPosition, endPos []*MsgPosition) *MsgStreamMsg {
|
2020-12-24 20:55:40 +08:00
|
|
|
return &MsgStreamMsg{
|
2021-01-26 09:44:39 +08:00
|
|
|
tsMessages: tsMessages,
|
|
|
|
timestampMin: timestampMin,
|
|
|
|
timestampMax: timestampMax,
|
2021-03-16 17:55:42 +08:00
|
|
|
startPositions: startPos,
|
|
|
|
endPositions: endPos,
|
2020-12-24 20:55:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-09 16:27:11 +08:00
|
|
|
func (msMsg *MsgStreamMsg) TimeTick() Timestamp {
|
|
|
|
return msMsg.timestampMax
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msMsg *MsgStreamMsg) DownStreamNodeIdx() int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-11-17 14:10:07 +08:00
|
|
|
func (msMsg *MsgStreamMsg) TsMessages() []msgstream.TsMsg {
|
|
|
|
return msMsg.tsMessages
|
2020-11-09 16:27:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (msMsg *MsgStreamMsg) TimestampMin() Timestamp {
|
|
|
|
return msMsg.timestampMin
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msMsg *MsgStreamMsg) TimestampMax() Timestamp {
|
|
|
|
return msMsg.timestampMax
|
|
|
|
}
|
2021-01-26 09:44:39 +08:00
|
|
|
|
|
|
|
func (msMsg *MsgStreamMsg) StartPositions() []*MsgPosition {
|
|
|
|
return msMsg.startPositions
|
|
|
|
}
|
2021-03-16 17:55:42 +08:00
|
|
|
|
|
|
|
func (msMsg *MsgStreamMsg) EndPositions() []*MsgPosition {
|
|
|
|
return msMsg.endPositions
|
|
|
|
}
|