hub

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 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 added in v0.23.0

type AgentEndpoint struct {
	common.RWMutex
	ws.DefaultSpeakerEventHandler

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

AgentEndpoint serves the graph for agents.

func NewPodEndpoint added in v0.23.0

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 added in v0.23.0

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

OnDisconnected called when an agent disconnected.

func (*AgentEndpoint) OnStructMessage added in v0.23.0

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 added in v0.23.0

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 added in v0.23.0

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 added in v0.23.0

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 added in v0.23.0

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

OnDisconnected called when a publisher got disconnected.

func (*PublisherEndpoint) OnStructMessage added in v0.23.0

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

OnStructMessage is triggered by message coming from a publisher.

type ReplicationEndpoint added in v0.23.0

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 added in v0.23.0

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 added in v0.23.0

func (t *ReplicationEndpoint) ConnectPeers()

ConnectPeers starts a goroutine connecting all the peers.

func (*ReplicationEndpoint) DisconnectPeers added in v0.23.0

func (t *ReplicationEndpoint) DisconnectPeers()

DisconnectPeers disconnects all the peers and wait until all disconnected.

func (*ReplicationEndpoint) GetSpeakers added in v0.23.0

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

GetSpeakers return both incoming and outgoing speakers

func (*ReplicationEndpoint) OnConnected added in v0.23.0

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

OnConnected is called when an incoming peer got connected.

func (*ReplicationEndpoint) OnDisconnected added in v0.23.0

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

OnDisconnected is called when an incoming peer got disconnected.

func (*ReplicationEndpoint) OnEdgeAdded added in v0.23.0

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

OnEdgeAdded graph edge added event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnEdgeDeleted added in v0.23.0

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

OnEdgeDeleted graph edge deleted event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnEdgeUpdated added in v0.23.0

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

OnEdgeUpdated graph edge updated event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnNodeAdded added in v0.23.0

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

OnNodeAdded graph node added event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnNodeDeleted added in v0.23.0

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

OnNodeDeleted graph node deleted event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnNodeUpdated added in v0.23.0

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

OnNodeUpdated graph node updated event. Implements the EventListener interface.

func (*ReplicationEndpoint) OnStructMessage added in v0.23.0

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

OnStructMessage is triggered by message coming from an other peer.

type ReplicatorPeer added in v0.23.0

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 added in v0.23.0

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 added in v0.23.0

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

Source Files

  • hub.go
  • pod_endpoint.go
  • publisher_endpoint.go
  • replication_endpoint.go

Jump to

Keyboard shortcuts

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