milvus/internal/reader/flow_graph_service_time_node.go
FluorineDog e7dd30a884 Add framework of ExecExprVisitor
Signed-off-by: FluorineDog <guilin.gou@zilliz.com>
2020-11-18 17:32:52 +08:00

50 lines
1.1 KiB
Go

package reader
import (
"log"
"github.com/zilliztech/milvus-distributed/internal/util/flowgraph"
)
type serviceTimeNode struct {
BaseNode
replica *collectionReplica
}
func (stNode *serviceTimeNode) Name() string {
return "stNode"
}
func (stNode *serviceTimeNode) Operate(in []*Msg) []*Msg {
// fmt.Println("Do serviceTimeNode operation")
if len(in) != 1 {
log.Println("Invalid operate message input in serviceTimeNode, input length = ", len(in))
// TODO: add error handling
}
serviceTimeMsg, ok := (*in[0]).(*serviceTimeMsg)
if !ok {
log.Println("type assertion failed for serviceTimeMsg")
// TODO: add error handling
}
// update service time
(*(*stNode.replica).getTSafe()).set(serviceTimeMsg.timeRange.timestampMax)
return nil
}
func newServiceTimeNode(replica *collectionReplica) *serviceTimeNode {
maxQueueLength := flowgraph.Params.FlowGraphMaxQueueLength()
maxParallelism := flowgraph.Params.FlowGraphMaxParallelism()
baseNode := BaseNode{}
baseNode.SetMaxQueueLength(maxQueueLength)
baseNode.SetMaxParallelism(maxParallelism)
return &serviceTimeNode{
BaseNode: baseNode,
replica: replica,
}
}