2020-10-29 12:42:47 +00:00
|
|
|
package msgstream
|
|
|
|
|
|
|
|
import (
|
2021-02-04 06:37:12 +00:00
|
|
|
"context"
|
|
|
|
|
2021-01-18 11:32:08 +00:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
|
2020-11-03 06:53:36 +00:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/util/typeutil"
|
|
|
|
)
|
2020-10-29 12:42:47 +00:00
|
|
|
|
2020-11-04 09:58:43 +00:00
|
|
|
type UniqueID = typeutil.UniqueID
|
|
|
|
type Timestamp = typeutil.Timestamp
|
|
|
|
type IntPrimaryKey = typeutil.IntPrimaryKey
|
2021-01-20 09:34:50 +00:00
|
|
|
type MsgPosition = internalpb2.MsgPosition
|
2020-11-04 09:58:43 +00:00
|
|
|
|
2020-10-29 12:42:47 +00:00
|
|
|
type MsgPack struct {
|
2021-01-20 09:34:50 +00:00
|
|
|
BeginTs Timestamp
|
|
|
|
EndTs Timestamp
|
|
|
|
Msgs []TsMsg
|
|
|
|
StartPositions []*MsgPosition
|
|
|
|
endPositions []*MsgPosition
|
2020-10-29 12:42:47 +00:00
|
|
|
}
|
|
|
|
|
2020-11-17 06:10:07 +00:00
|
|
|
type RepackFunc func(msgs []TsMsg, hashKeys [][]int32) (map[int32]*MsgPack, error)
|
2020-10-29 12:42:47 +00:00
|
|
|
|
|
|
|
type MsgStream interface {
|
2020-11-02 08:01:04 +00:00
|
|
|
Start()
|
|
|
|
Close()
|
2021-02-03 09:30:10 +00:00
|
|
|
Chan() <-chan *MsgPack
|
2021-02-04 06:37:12 +00:00
|
|
|
AsProducer(channels []string)
|
|
|
|
AsConsumer(channels []string, subName string)
|
|
|
|
SetRepackFunc(repackFunc RepackFunc)
|
2020-11-02 08:01:04 +00:00
|
|
|
|
2021-02-24 01:48:17 +00:00
|
|
|
Produce(context.Context, *MsgPack) error
|
|
|
|
Broadcast(context.Context, *MsgPack) error
|
2020-11-07 05:19:31 +00:00
|
|
|
Consume() *MsgPack
|
2021-01-20 09:34:50 +00:00
|
|
|
Seek(offset *MsgPosition) error
|
2020-11-12 03:18:23 +00:00
|
|
|
}
|
2021-02-04 06:37:12 +00:00
|
|
|
|
|
|
|
type Factory interface {
|
2021-02-08 06:30:54 +00:00
|
|
|
SetParams(params map[string]interface{}) error
|
2021-02-04 06:37:12 +00:00
|
|
|
NewMsgStream(ctx context.Context) (MsgStream, error)
|
|
|
|
NewTtMsgStream(ctx context.Context) (MsgStream, error)
|
|
|
|
}
|