Documentation ¶
Index ¶
- Constants
- type EventHandle
- func (eh *EventHandle) CancelNode(hi hubio.CloudHubIO, info *emodel.HubInfo, code ExitCode)
- func (eh *EventHandle) EnrollNode(hi hubio.CloudHubIO, info *emodel.HubInfo) error
- func (eh *EventHandle) GetNodeCount() int
- func (eh *EventHandle) GetWorkload() (float64, error)
- func (eh *EventHandle) Pub2Controller(info *emodel.HubInfo, msg *model.Message) error
- func (eh *EventHandle) ServeConn(hi hubio.CloudHubIO, info *emodel.HubInfo)
- type ExitCode
- type HandleFunc
- type QuicHandle
- func (qh *QuicHandle) EventWriteLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
- func (qh *QuicHandle) HandleServer(container *mux.MessageContainer, writer mux.ResponseWriter)
- func (qh *QuicHandle) KeepaliveCheckLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
- func (qh *QuicHandle) OnRegister(connection conn.Connection)
- type WebsocketHandle
- func (wh *WebsocketHandle) EventReadLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
- func (wh *WebsocketHandle) EventWriteLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
- func (wh *WebsocketHandle) ServeEvent(w http.ResponseWriter, r *http.Request)
- func (wh *WebsocketHandle) ServeQueueWorkload(w http.ResponseWriter, r *http.Request)
Constants ¶
const (
MsgFormatError = "message format not correct"
)
constants for error message
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventHandle ¶
type EventHandle struct { KeepaliveInterval int WriteTimeout int Nodes sync.Map EventQueue *channelq.ChannelEventQueue Context *context.Context Handlers []HandleFunc // contains filtered or unexported fields }
EventHandle processes events between cloud and edge
func (*EventHandle) CancelNode ¶
func (eh *EventHandle) CancelNode(hi hubio.CloudHubIO, info *emodel.HubInfo, code ExitCode)
func (*EventHandle) EnrollNode ¶
func (eh *EventHandle) EnrollNode(hi hubio.CloudHubIO, info *emodel.HubInfo) error
EnrollNode enroll node for the incoming connection
func (*EventHandle) GetNodeCount ¶
func (eh *EventHandle) GetNodeCount() int
GetNodeCount returns the number of connected Nodes
func (*EventHandle) GetWorkload ¶
func (eh *EventHandle) GetWorkload() (float64, error)
GetWorkload returns the workload of the event queue
func (*EventHandle) Pub2Controller ¶
func (*EventHandle) ServeConn ¶
func (eh *EventHandle) ServeConn(hi hubio.CloudHubIO, info *emodel.HubInfo)
ServeConn starts serving the incoming connection
type HandleFunc ¶
type HandleFunc func(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
type QuicHandle ¶
type QuicHandle struct { EventHandler *EventHandle NodeLimit int KeepaliveChannel chan struct{} }
QuicHandle access handler
var QuicHandler *QuicHandle
QuicHandler handle all request from quic
func (*QuicHandle) EventWriteLoop ¶
func (qh *QuicHandle) EventWriteLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
EventWriteLoop loop write cloud msg to edge
func (*QuicHandle) HandleServer ¶
func (qh *QuicHandle) HandleServer(container *mux.MessageContainer, writer mux.ResponseWriter)
HandleServer handle all the request from quic
func (*QuicHandle) KeepaliveCheckLoop ¶
func (qh *QuicHandle) KeepaliveCheckLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
KeepaliveCheckLoop checks whether the edge node is still alive
func (*QuicHandle) OnRegister ¶
func (qh *QuicHandle) OnRegister(connection conn.Connection)
OnRegister regist node on first connection
type WebsocketHandle ¶
type WebsocketHandle struct { EventHandler *EventHandle NodeLimit int }
WebsocketHandle access handler
var WebSocketHandler *WebsocketHandle
WebSocketHandler handle all request from websocket
func (*WebsocketHandle) EventReadLoop ¶
func (wh *WebsocketHandle) EventReadLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
EventReadLoop processes all read requests
func (*WebsocketHandle) EventWriteLoop ¶
func (wh *WebsocketHandle) EventWriteLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)
EventWriteLoop processes all write requests
func (*WebsocketHandle) ServeEvent ¶
func (wh *WebsocketHandle) ServeEvent(w http.ResponseWriter, r *http.Request)
ServeEvent handle the event coming from websocket
func (*WebsocketHandle) ServeQueueWorkload ¶
func (wh *WebsocketHandle) ServeQueueWorkload(w http.ResponseWriter, r *http.Request)
ServeQueueWorkload handle workload from queue