Documentation
¶
Index ¶
- Constants
- Variables
- type Manager
- func (sm *Manager) AddSession(session *NodeSession)
- func (sm *Manager) DeleteSession(session *NodeSession)
- func (sm *Manager) GetSession(nodeID string) (*NodeSession, bool)
- func (sm *Manager) KeepAliveMessage(nodeID string) error
- func (sm *Manager) ReachLimit() bool
- func (sm *Manager) ReceiveMessageAck(nodeID, parentID string) error
- type NodeSession
- func (ns *NodeSession) GetTerminateErr() int32
- func (ns *NodeSession) KeepAliveCheck()
- func (ns *NodeSession) KeepAliveMessage()
- func (ns *NodeSession) ReceiveMessageAck(parentID string)
- func (ns *NodeSession) SendAckMessage()
- func (ns *NodeSession) SendNoAckMessage()
- func (ns *NodeSession) SetTerminateErr(terminateErr int32)
- func (ns *NodeSession) Start()
- func (ns *NodeSession) Terminating()
Constants ¶
const ( NoErr = iota TransportErr NodeStopErr QueueShutdownErr )
session termination error type
Variables ¶
var ErrWaitTimeout = errors.New("timed out waiting for the condition")
ErrWaitTimeout is returned when the condition exited without success.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct { // NodeNumber is the number of currently connected edge // nodes for single cloudHub instance NodeNumber int32 // NodeLimit is the maximum number of edge nodes that can // connected to single cloudHub instance NodeLimit int32 // NodeSessions maps a node ID to NodeSession NodeSessions sync.Map }
func NewSessionManager ¶
NewSessionManager initializes a new SessionManager
func (*Manager) AddSession ¶
func (sm *Manager) AddSession(session *NodeSession)
AddSession add node session to the session manager
func (*Manager) DeleteSession ¶
func (sm *Manager) DeleteSession(session *NodeSession)
DeleteSession delete the node session from session manager
func (*Manager) GetSession ¶
func (sm *Manager) GetSession(nodeID string) (*NodeSession, bool)
GetSession get the node session for the node
func (*Manager) KeepAliveMessage ¶
KeepAliveMessage receive keepalive message from edge node
func (*Manager) ReachLimit ¶
ReachLimit checks whether the connected nodes exceeds the node limit number
func (*Manager) ReceiveMessageAck ¶
ReceiveMessageAck receive the message ack from edge node
type NodeSession ¶
type NodeSession struct {
// contains filtered or unexported fields
}
NodeSession is an abstraction of a node connection lifecycle.
func NewNodeSession ¶
func NewNodeSession( nodeID, projectID string, connection conn.Connection, keepaliveInterval time.Duration, nodeMessagePool *common.NodeMessagePool, reliableClient reliableclient.Interface, ) *NodeSession
func (*NodeSession) GetTerminateErr ¶
func (ns *NodeSession) GetTerminateErr() int32
func (*NodeSession) KeepAliveCheck ¶
func (ns *NodeSession) KeepAliveCheck()
KeepAliveCheck A goroutine running KeepAliveCheck is started for each connection.
func (*NodeSession) KeepAliveMessage ¶
func (ns *NodeSession) KeepAliveMessage()
KeepAliveMessage receive keepalive message from edge node
func (*NodeSession) ReceiveMessageAck ¶
func (ns *NodeSession) ReceiveMessageAck(parentID string)
ReceiveMessageAck receive the message ack from edge node
func (*NodeSession) SendAckMessage ¶
func (ns *NodeSession) SendAckMessage()
SendAckMessage loops forever sending message that require acknowledgment to the edge node until an error is encountered (or the connection is closed).
func (*NodeSession) SendNoAckMessage ¶
func (ns *NodeSession) SendNoAckMessage()
SendNoAckMessage loops forever sending the message that does not require acknowledgment to the edge node until an error is encountered (or the connection is closed).
func (*NodeSession) SetTerminateErr ¶
func (ns *NodeSession) SetTerminateErr(terminateErr int32)
func (*NodeSession) Start ¶
func (ns *NodeSession) Start()
Start the main goroutine responsible for serving node session
func (*NodeSession) Terminating ¶
func (ns *NodeSession) Terminating()
Terminating terminates the node session and it is called when the client goes offline, It will shutdown the message queue and the goroutine associated with it will exit.