2021-01-19 03:37:16 +00:00
|
|
|
package datanode
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/msgstream"
|
2021-01-20 02:02:59 +00:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/msgstream/pulsarms"
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/msgstream/util"
|
2021-01-19 03:37:16 +00:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/util/flowgraph"
|
|
|
|
)
|
|
|
|
|
|
|
|
func newDmInputNode(ctx context.Context) *flowgraph.InputNode {
|
|
|
|
receiveBufSize := Params.InsertReceiveBufSize
|
|
|
|
pulsarBufSize := Params.InsertPulsarBufSize
|
|
|
|
|
|
|
|
msgStreamURL := Params.PulsarAddress
|
|
|
|
|
|
|
|
consumeChannels := Params.InsertChannelNames
|
|
|
|
consumeSubName := Params.MsgChannelSubName
|
|
|
|
|
2021-01-20 02:02:59 +00:00
|
|
|
insertStream := pulsarms.NewPulsarTtMsgStream(ctx, receiveBufSize)
|
2021-01-19 03:37:16 +00:00
|
|
|
|
|
|
|
insertStream.SetPulsarClient(msgStreamURL)
|
2021-01-20 02:02:59 +00:00
|
|
|
unmarshalDispatcher := util.NewUnmarshalDispatcher()
|
2021-01-19 03:37:16 +00:00
|
|
|
|
|
|
|
insertStream.CreatePulsarConsumers(consumeChannels, consumeSubName, unmarshalDispatcher, pulsarBufSize)
|
|
|
|
|
|
|
|
var stream msgstream.MsgStream = insertStream
|
|
|
|
|
|
|
|
maxQueueLength := Params.FlowGraphMaxQueueLength
|
|
|
|
maxParallelism := Params.FlowGraphMaxParallelism
|
|
|
|
|
|
|
|
node := flowgraph.NewInputNode(&stream, "dmInputNode", maxQueueLength, maxParallelism)
|
|
|
|
return node
|
|
|
|
}
|
|
|
|
|
|
|
|
func newDDInputNode(ctx context.Context) *flowgraph.InputNode {
|
|
|
|
receiveBufSize := Params.DDReceiveBufSize
|
|
|
|
pulsarBufSize := Params.DDPulsarBufSize
|
|
|
|
|
|
|
|
msgStreamURL := Params.PulsarAddress
|
|
|
|
|
|
|
|
consumeChannels := Params.DDChannelNames
|
|
|
|
consumeSubName := Params.MsgChannelSubName
|
|
|
|
|
2021-01-20 02:02:59 +00:00
|
|
|
ddStream := pulsarms.NewPulsarTtMsgStream(ctx, receiveBufSize)
|
2021-01-19 03:37:16 +00:00
|
|
|
ddStream.SetPulsarClient(msgStreamURL)
|
2021-01-20 02:02:59 +00:00
|
|
|
unmarshalDispatcher := util.NewUnmarshalDispatcher()
|
2021-01-19 03:37:16 +00:00
|
|
|
ddStream.CreatePulsarConsumers(consumeChannels, consumeSubName, unmarshalDispatcher, pulsarBufSize)
|
|
|
|
|
|
|
|
var stream msgstream.MsgStream = ddStream
|
|
|
|
|
|
|
|
maxQueueLength := Params.FlowGraphMaxQueueLength
|
|
|
|
maxParallelism := Params.FlowGraphMaxParallelism
|
|
|
|
|
|
|
|
node := flowgraph.NewInputNode(&stream, "ddInputNode", maxQueueLength, maxParallelism)
|
|
|
|
return node
|
|
|
|
}
|