// HandleServer handle all the request from node
HandleServer handle all the request from node
// HandleServer handle all the request from node
func (mh *MessageHandle) HandleServer(container *mux.MessageContainer, writer mux.ResponseWriter) {
	nodeID := container.Header.Get("node_id")
	projectID := container.Header.Get("project_id")
	if mh.GetNodeCount() >= mh.NodeLimit {
		klog.Errorf("Fail to serve node %s, reach node limit", nodeID)
		return
	}
	if container.Message.GetOperation() == model.OpKeepalive {
		klog.Infof("Keepalive message received from node: %s", nodeID)
		mh.KeepaliveChannel[nodeID] <- struct{}{}
		return
	}
	if VolumeRegExp.MatchString(container.Message.GetResource()) {
		beehiveContext.SendResp(*container.Message)
		return
	}
	err := mh.PubToController(&model.HubInfo{ProjectID: projectID, NodeID: nodeID}, container.Message)
	if err != nil {
		klog.Errorf("Failed to serve handle with error: %s", err.Error())
	}
}
func ( mh * MessageHandle ) HandleServer ( container * mux . MessageContainer , writer mux . ResponseWriter ) { nodeID := container . Header . Get ( " " ) projectID := container . Header . Get ( " " ) if mh . GetNodeCount ( ) >= mh . NodeLimit { klog . Errorf ( " " , nodeID ) return } if container . Message . GetOperation ( ) == model . OpKeepalive { klog . Infof ( " " , nodeID ) mh . KeepaliveChannel [ nodeID ] <- struct { } { } return } if VolumeRegExp . MatchString ( container . Message . GetResource ( ) ) { beehiveContext . SendResp ( * container . Message ) return } err := mh . PubToController ( & model . HubInfo { ProjectID : projectID , NodeID : nodeID } , container . Message ) if err != nil { klog . Errorf ( " " , err . Error ( ) ) } }
HandleServer handle all the request from node
HandleServer handle all the request from node
// handle the reponse from edge // if err, we should stop node, write data to edgehub, stop nodify