hub

package
v0.0.0-...-1d39891 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentEndpoint

type AgentEndpoint struct {
	common.RWMutex
	ws.DefaultSpeakerEventHandler

	Graph *graph.Graph
	// contains filtered or unexported fields
}

AgentEndpoint serves the graph for agents.

func NewPodEndpoint

func NewPodEndpoint(pool ws.StructSpeakerPool, cached *graph.CachedBackend, g *graph.Graph) (*AgentEndpoint, error)

NewPodEndpoint returns a new server that handles messages from the agents

func (*AgentEndpoint) OnDisconnected

func (t *AgentEndpoint) OnDisconnected(c ws.Speaker)

OnDisconnected called when an agent disconnected.

func (*AgentEndpoint) OnStructMessage

func (t *AgentEndpoint) OnStructMessage(c ws.Speaker, msg *ws.StructMessage)

OnStructMessage is triggered when a message from the agent is received.

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub describes a graph hub that accepts incoming connections from pods, other hubs, subscribers or external publishers

func NewHub

func NewHub(server *shttp.Server, g *graph.Graph, cached *graph.CachedBackend, apiAuthBackend, clusterAuthBackend shttp.AuthenticationBackend, clusterAuthOptions *shttp.AuthenticationOpts, podEndpoint string, peers []common.ServiceAddress, opts Opts) (*Hub, error)

NewHub returns a new hub

func (*Hub) GetStatus

func (h *Hub) GetStatus() *Status

GetStatus returns the status of a hub

func (*Hub) PodServer

func (h *Hub) PodServer() *websocket.StructServer

PodServer returns the websocket server dedicated to pods

func (*Hub) Start

func (h *Hub) Start()

Start the hub

func (*Hub) Stop

func (h *Hub) Stop()

Stop the hub

func (*Hub) SubscriberServer

func (h *Hub) SubscriberServer() *websocket.StructServer

SubscriberServer returns the websocket server dedicated to subcribers

type Opts

type Opts struct {
	ServerOpts websocket.ServerOpts
	Validator  validator.Validator
}

Opts Hub options

type PeersStatus

type PeersStatus struct {
	Incomers map[string]websocket.ConnStatus
	Outgoers map[string]websocket.ConnStatus
}

PeersStatus describes the state of a peer

type PersistencePolicy

type PersistencePolicy string

PersistencePolicy defines Persistent policy for publishers

const (
	// Persistent means that the graph elements created will always remain
	Persistent PersistencePolicy = "Persistent"
	// DeleteOnDisconnect means the graph elements created will be deleted on client disconnect
	DeleteOnDisconnect PersistencePolicy = "DeleteOnDisconnect"
)

type PublisherEndpoint

type PublisherEndpoint struct {
	common.RWMutex
	ws.DefaultSpeakerEventHandler

	Graph *graph.Graph
	// contains filtered or unexported fields
}

PublisherEndpoint serves the graph for external publishers, for instance an external program that interacts with the Skydive graph.

func NewPublisherEndpoint

func NewPublisherEndpoint(pool ws.StructSpeakerPool, cached *graph.CachedBackend, g *graph.Graph, validator validator.Validator) (*PublisherEndpoint, error)

NewPublisherEndpoint returns a new server for external publishers.

func (*PublisherEndpoint) OnDisconnected

func (t *PublisherEndpoint) OnDisconnected(c ws.Speaker)

OnDisconnected called when a publisher got disconnected.

func (*PublisherEndpoint) OnStructMessage

func (t *PublisherEndpoint) OnStructMessage(c ws.Speaker, msg *ws.StructMessage)

OnStructMessage is triggered by message coming from a publisher.

type ReplicationEndpoint

type ReplicationEndpoint struct {
	common.RWMutex
	ws.DefaultSpeakerEventHandler

	Graph *graph.Graph
	// contains filtered or unexported fields
}

ReplicationEndpoint serves the local Graph and send local modification to its peers.

func NewReplicationEndpoint

func NewReplicationEndpoint(pool ws.StructSpeakerPool, auth *shttp.AuthenticationOpts, cached *graph.CachedBackend, g *graph.Graph, peers []common.ServiceAddress) (*ReplicationEndpoint, error)

NewReplicationEndpoint returns a new server to be used by other analyzers for replication.

func (*ReplicationEndpoint) ConnectPeers

func (t *ReplicationEndpoint) ConnectPeers()

ConnectPeers starts a goroutine connecting all the peers.

func (*ReplicationEndpoint) DisconnectPeers

func (t *ReplicationEndpoint) DisconnectPeers()

DisconnectPeers disconnects all the peers and wait until all disconnected.

func (*ReplicationEndpoint) GetSpeakers

func (t *ReplicationEndpoint) GetSpeakers() []ws.Speaker

GetSpeakers return both incoming and outgoing speakers

func (*ReplicationEndpoint) OnConnected

func (t *ReplicationEndpoint) OnConnected(c ws.Speaker)

OnConnected is called when an incoming peer got connected.

func (*ReplicationEndpoint) OnDisconnected

func (t *ReplicationEndpoint) OnDisconnected(c ws.Speaker)

OnDisconnected is called when an incoming peer got disconnected.

func (*ReplicationEndpoint) OnEdgeAdded

func (t *ReplicationEndpoint) OnEdgeAdded(e *graph.Edge)

OnEdgeAdded graph edge added event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnEdgeDeleted

func (t *ReplicationEndpoint) OnEdgeDeleted(e *graph.Edge)

OnEdgeDeleted graph edge deleted event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnEdgeUpdated

func (t *ReplicationEndpoint) OnEdgeUpdated(e *graph.Edge)

OnEdgeUpdated graph edge updated event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnNodeAdded

func (t *ReplicationEndpoint) OnNodeAdded(n *graph.Node)

OnNodeAdded graph node added event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnNodeDeleted

func (t *ReplicationEndpoint) OnNodeDeleted(n *graph.Node)

OnNodeDeleted graph node deleted event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnNodeUpdated

func (t *ReplicationEndpoint) OnNodeUpdated(n *graph.Node)

OnNodeUpdated graph node updated event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnStructMessage

func (t *ReplicationEndpoint) OnStructMessage(c ws.Speaker, msg *ws.StructMessage)

OnStructMessage is triggered by message coming from an other peer.

type ReplicatorPeer

type ReplicatorPeer struct {
	ws.DefaultSpeakerEventHandler
	URL      *url.URL
	Graph    *graph.Graph
	AuthOpts *shttp.AuthenticationOpts
	// contains filtered or unexported fields
}

ReplicatorPeer is a remote connection to another Graph server. Only modification of the local Graph made either by the local server, by an agent message or by an external client will be forwarded to the peer.

func (*ReplicatorPeer) OnConnected

func (p *ReplicatorPeer) OnConnected(c ws.Speaker)

OnConnected is called when the peer gets connected then the whole graph is send to initialize it.

func (*ReplicatorPeer) OnDisconnected

func (p *ReplicatorPeer) OnDisconnected(c ws.Speaker)

OnDisconnected is called when the peer gets disconnected

type Status

type Status struct {
	Pods        map[string]websocket.ConnStatus
	Peers       PeersStatus
	Publishers  map[string]websocket.ConnStatus
	Subscribers map[string]websocket.ConnStatus
}

Status describes the status of a hub

Jump to

Keyboard shortcuts

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