flow_graph_dmstream_input_node.go 1.6 KB
Newer Older
X
XuanYang-cn 已提交
1 2 3 4 5 6 7 8 9 10 11
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.

X
XuanYang-cn 已提交
12 13 14 15 16
package datanode

import (
	"context"

X
Xiangyu Wang 已提交
17 18
	"github.com/milvus-io/milvus/internal/log"
	"github.com/milvus-io/milvus/internal/msgstream"
X
XuanYang-cn 已提交
19
	"github.com/milvus-io/milvus/internal/proto/internalpb"
X
Xiangyu Wang 已提交
20
	"github.com/milvus-io/milvus/internal/util/flowgraph"
X
XuanYang-cn 已提交
21 22
)

X
XuanYang-cn 已提交
23
func newDmInputNode(ctx context.Context, factory msgstream.Factory, vchannelName string, seekPos *internalpb.MsgPosition) *flowgraph.InputNode {
24
	// TODO seek
25 26
	maxQueueLength := Params.FlowGraphMaxQueueLength
	maxParallelism := Params.FlowGraphMaxParallelism
X
XuanYang-cn 已提交
27
	// consumeSubName := Params.MsgChannelSubName
X
XuanYang-cn 已提交
28

Z
zhenshan.cao 已提交
29
	insertStream, _ := factory.NewTtMsgStream(ctx)
X
XuanYang-cn 已提交
30 31 32 33 34
	insertStream.Seek([]*internalpb.MsgPosition{seekPos})

	// insertStream.AsConsumer([]string{vchannelName}, consumeSubName)
	// log.Debug("datanode AsConsumer: " + vchannelName + " : " + consumeSubName)
	log.Debug("datanode Seek: " + vchannelName)
X
XuanYang-cn 已提交
35 36 37 38 39

	var stream msgstream.MsgStream = insertStream
	node := flowgraph.NewInputNode(&stream, "dmInputNode", maxQueueLength, maxParallelism)
	return node
}