mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 03:48:37 +08:00
881be7f3e3
Signed-off-by: XuanYang-cn <xuan.yang@zilliz.com>
62 lines
1.3 KiB
Go
62 lines
1.3 KiB
Go
package writenode
|
|
|
|
import (
|
|
"log"
|
|
)
|
|
|
|
type (
|
|
writeNode struct {
|
|
BaseNode
|
|
}
|
|
)
|
|
|
|
func (wNode *writeNode) Name() string {
|
|
return "wNode"
|
|
}
|
|
|
|
func (wNode *writeNode) Operate(in []*Msg) []*Msg {
|
|
log.Println("=========== WriteNode Operating")
|
|
|
|
if len(in) != 1 {
|
|
log.Println("Invalid operate message input in writetNode, input length = ", len(in))
|
|
// TODO: add error handling
|
|
}
|
|
|
|
iMsg, ok := (*in[0]).(*insertMsg)
|
|
if !ok {
|
|
log.Println("type assertion failed for insertMsg")
|
|
// TODO: add error handling
|
|
}
|
|
|
|
log.Println("=========== insertMsg length:", len(iMsg.insertMessages))
|
|
for _, task := range iMsg.insertMessages {
|
|
if len(task.RowIDs) != len(task.Timestamps) || len(task.RowIDs) != len(task.RowData) {
|
|
log.Println("Error, misaligned messages detected")
|
|
continue
|
|
}
|
|
log.Println("Timestamp: ", task.Timestamps[0])
|
|
log.Printf("t(%d) : %v ", task.Timestamps[0], task.RowData[0])
|
|
}
|
|
|
|
var res Msg = &serviceTimeMsg{
|
|
timeRange: iMsg.timeRange,
|
|
}
|
|
|
|
// TODO
|
|
return []*Msg{&res}
|
|
|
|
}
|
|
|
|
func newWriteNode() *writeNode {
|
|
maxQueueLength := Params.flowGraphMaxQueueLength()
|
|
maxParallelism := Params.flowGraphMaxParallelism()
|
|
|
|
baseNode := BaseNode{}
|
|
baseNode.SetMaxQueueLength(maxQueueLength)
|
|
baseNode.SetMaxParallelism(maxParallelism)
|
|
|
|
return &writeNode{
|
|
BaseNode: baseNode,
|
|
}
|
|
}
|