wsserver

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgFormatError = "message format not correct"
)

constants for error message

View Source
const (
	PathEvent = "/{project_id}/{node_id}/events"
)

constants for api path

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessHandle

type AccessHandle struct {
	EventHandle *EventHandle
	NodeLimit   int
}

AccessHandle access handler

func (*AccessHandle) ServeEvent

func (ah *AccessHandle) ServeEvent(w http.ResponseWriter, r *http.Request)

ServeEvent handle the event coming from websocket

func (*AccessHandle) ServeQueueWorkload

func (ah *AccessHandle) ServeQueueWorkload(w http.ResponseWriter, r *http.Request)

ServeQueueWorkload handle workload from queue

type EventHandle

type EventHandle struct {
	KeepaliveInterval int
	WriteTimeout      int
	Nodes             sync.Map

	EventQueue *channelq.ChannelEventQueue
	Context    *context.Context
	// contains filtered or unexported fields
}

EventHandle processes events between cloud and edge

var EventHandler *EventHandle

EventHandler handle all event

func (*EventHandle) EventReadLoop

func (eh *EventHandle) EventReadLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)

EventReadLoop processes all read requests

func (*EventHandle) EventWriteLoop

func (eh *EventHandle) EventWriteLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode)

EventWriteLoop processes all write requests

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) ServeConn

func (eh *EventHandle) ServeConn(hi hubio.CloudHubIO, info *emodel.HubInfo)

ServeConn starts serving the incoming connection

type ExitCode

type ExitCode int

ExitCode exit code

type FilterWriter

type FilterWriter struct{}

FilterWriter filter writer

func (*FilterWriter) Write

func (f *FilterWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL