2021-01-15 07:28:54 +00:00
|
|
|
package querynodeimp
|
2020-11-02 11:30:12 +00:00
|
|
|
|
2020-11-05 02:52:50 +00:00
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
)
|
2020-11-04 08:28:14 +00:00
|
|
|
|
2020-11-02 11:30:12 +00:00
|
|
|
type serviceTimeNode struct {
|
2021-01-15 07:28:54 +00:00
|
|
|
baseNode
|
2020-12-08 06:41:04 +00:00
|
|
|
replica collectionReplica
|
2020-11-02 11:30:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (stNode *serviceTimeNode) Name() string {
|
2020-11-05 02:52:50 +00:00
|
|
|
return "stNode"
|
2020-11-02 11:30:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (stNode *serviceTimeNode) Operate(in []*Msg) []*Msg {
|
2020-11-28 11:06:48 +00:00
|
|
|
//fmt.Println("Do serviceTimeNode operation")
|
2020-11-05 02:52:50 +00:00
|
|
|
|
2020-11-04 08:28:14 +00:00
|
|
|
if len(in) != 1 {
|
2020-11-12 04:04:12 +00:00
|
|
|
log.Println("Invalid operate message input in serviceTimeNode, input length = ", len(in))
|
2020-11-04 08:28:14 +00:00
|
|
|
// TODO: add error handling
|
|
|
|
}
|
|
|
|
|
|
|
|
serviceTimeMsg, ok := (*in[0]).(*serviceTimeMsg)
|
|
|
|
if !ok {
|
|
|
|
log.Println("type assertion failed for serviceTimeMsg")
|
|
|
|
// TODO: add error handling
|
|
|
|
}
|
|
|
|
|
2020-11-09 08:27:11 +00:00
|
|
|
// update service time
|
2020-12-08 06:41:04 +00:00
|
|
|
stNode.replica.getTSafe().set(serviceTimeMsg.timeRange.timestampMax)
|
2020-11-28 11:06:48 +00:00
|
|
|
//fmt.Println("update tSafe to:", getPhysicalTime(serviceTimeMsg.timeRange.timestampMax))
|
2021-01-06 08:44:12 +00:00
|
|
|
|
|
|
|
var res Msg = &gcMsg{
|
|
|
|
gcRecord: serviceTimeMsg.gcRecord,
|
|
|
|
timeRange: serviceTimeMsg.timeRange,
|
|
|
|
}
|
|
|
|
return []*Msg{&res}
|
2020-11-02 11:30:12 +00:00
|
|
|
}
|
|
|
|
|
2020-12-08 06:41:04 +00:00
|
|
|
func newServiceTimeNode(replica collectionReplica) *serviceTimeNode {
|
2020-12-10 08:31:09 +00:00
|
|
|
maxQueueLength := Params.FlowGraphMaxQueueLength
|
|
|
|
maxParallelism := Params.FlowGraphMaxParallelism
|
2020-11-18 09:32:52 +00:00
|
|
|
|
2021-01-15 07:28:54 +00:00
|
|
|
baseNode := baseNode{}
|
2020-11-02 11:30:12 +00:00
|
|
|
baseNode.SetMaxQueueLength(maxQueueLength)
|
|
|
|
baseNode.SetMaxParallelism(maxParallelism)
|
|
|
|
|
|
|
|
return &serviceTimeNode{
|
2021-01-15 07:28:54 +00:00
|
|
|
baseNode: baseNode,
|
2020-11-17 12:00:23 +00:00
|
|
|
replica: replica,
|
2020-11-02 11:30:12 +00:00
|
|
|
}
|
|
|
|
}
|