handler

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MsgFormatError = "message format not correct"
	VolumePattern  = `^\w[-\w.+]*/` + constants.CSIResourceTypeVolume + `/\w[-\w.+]*`
)

constants for error message

Variables

VolumeRegExp is used to validate the volume resource

Functions

func InitHandler added in v1.1.0

func InitHandler(eventq *channelq.ChannelMessageQueue)

InitHandler create a handler for websocket and quic servers

Types

type ExitCode

type ExitCode int

ExitCode exit code

type HandleFunc

type HandleFunc func(hi hubio.CloudHubIO, info *model.HubInfo, exitServe chan ExitCode, stopSendMsg chan struct{})

type MessageHandle added in v1.2.0

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

	MessageQueue     *channelq.ChannelMessageQueue
	Handlers         []HandleFunc
	NodeLimit        int
	KeepaliveChannel map[string]chan struct{}
	MessageAcks      sync.Map
	// contains filtered or unexported fields
}

MessageHandle processes messages between cloud and edge

var CloudhubHandler *MessageHandle

CloudhubHandler the shared handler for both websocket and quic servers

func (*MessageHandle) GetNodeCount added in v1.2.0

func (mh *MessageHandle) GetNodeCount() int

GetNodeCount returns the number of connected Nodes

func (*MessageHandle) HandleServer added in v1.2.0

func (mh *MessageHandle) HandleServer(container *mux.MessageContainer, writer mux.ResponseWriter)

HandleServer handle all the request from node

func (*MessageHandle) KeepaliveCheckLoop added in v1.2.0

func (mh *MessageHandle) KeepaliveCheckLoop(hi hubio.CloudHubIO, info *model.HubInfo, stopServe chan ExitCode, stopSendMsg chan struct{})

KeepaliveCheckLoop checks whether the edge node is still alive

func (*MessageHandle) ListMessageWriteLoop added in v1.2.0

func (mh *MessageHandle) ListMessageWriteLoop(hi hubio.CloudHubIO, info *model.HubInfo, stopServe chan ExitCode, stopSendMsg chan struct{})

ListMessageWriteLoop processes all list type resource write requests

func (*MessageHandle) MessageWriteLoop added in v1.2.0

func (mh *MessageHandle) MessageWriteLoop(hi hubio.CloudHubIO, info *model.HubInfo, stopServe chan ExitCode, stopSendMsg chan struct{})

MessageWriteLoop processes all write requests

func (*MessageHandle) OnRegister added in v1.2.0

func (mh *MessageHandle) OnRegister(connection conn.Connection)

OnRegister register node on first connection

func (*MessageHandle) PubToController added in v1.2.0

func (mh *MessageHandle) PubToController(info *model.HubInfo, msg *beehiveModel.Message) error

func (*MessageHandle) RegisterNode added in v1.2.0

func (mh *MessageHandle) RegisterNode(hi hubio.CloudHubIO, info *model.HubInfo) error

RegisterNode register node in cloudhub for the incoming connection

func (*MessageHandle) ServeConn added in v1.2.0

func (mh *MessageHandle) ServeConn(hi hubio.CloudHubIO, info *model.HubInfo)

ServeConn starts serving the incoming connection

func (*MessageHandle) UnregisterNode added in v1.2.0

func (mh *MessageHandle) UnregisterNode(hi hubio.CloudHubIO, info *model.HubInfo, code ExitCode)

UnregisterNode unregister node in cloudhub

Jump to

Keyboard shortcuts

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