streaming

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AgentConnectedEventString = "agentConnected"
View Source
const AgentDisconnectedEventString = "agentDisconnected"
View Source
const EnvsUpdatedEventString = "envsUpdated"
View Source
const StaleRepoDataEventString = "staleRepoData"

Variables

This section is empty.

Functions

func ServeWs

func ServeWs(hub *ClientHub, w http.ResponseWriter, r *http.Request)

ServeWs handles websocket requests from the peer.

Types

type AgentConnectedEvent

type AgentConnectedEvent struct {
	Agent ConnectedAgent `json:"agent"`
	StreamingEvent
}

type AgentDisconnectedEvent

type AgentDisconnectedEvent struct {
	Agent ConnectedAgent `json:"agent"`
	StreamingEvent
}

type AgentHub

type AgentHub struct {
	Agents map[string]*ConnectedAgent

	// Register requests from the agents.
	Register chan *ConnectedAgent

	// Unregister requests from agents.
	Unregister chan *ConnectedAgent
	// contains filtered or unexported fields
}

AgentHub is the central registry of all connected agents

func NewAgentHub

func NewAgentHub(config *config.Config) *AgentHub

func (*AgentHub) ForceStateSend

func (h *AgentHub) ForceStateSend()

func (*AgentHub) Run

func (h *AgentHub) Run()

type Client

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

Client is a middleman between the websocket connection and the hub.

type ClientHub

type ClientHub struct {
	// Registered clients.
	Clients map[*Client]bool

	// Updates to be broadcasted to the clients.
	Broadcast chan []byte

	// Register requests from the clients.
	Register chan *Client

	// Unregister requests from clients.
	Unregister chan *Client
}

ClientHub maintains the set of active clients and broadcasts messages to the clients.

func NewClientHub

func NewClientHub() *ClientHub

func (*ClientHub) Run

func (h *ClientHub) Run()

type ConnectedAgent

type ConnectedAgent struct {
	Name         string       `json:"name"`
	Namespace    string       `json:"namespace"`
	EventChannel chan []byte  `json:"-"`
	Stacks       []*api.Stack `json:"-"`
}

ConnectedAgent represents a connected k8s cluster

func (*ConnectedAgent) RepoStacks

func (a *ConnectedAgent) RepoStacks(repo string) []*api.Stack

type EnvsUpdatedEvent

type EnvsUpdatedEvent struct {
	Envs []*api.Env `json:"envs"`
	StreamingEvent
}

type StaleRepoDataEvent

type StaleRepoDataEvent struct {
	Repo string `json:"repo"`
	StreamingEvent
}

type StreamingEvent

type StreamingEvent struct {
	Event string `json:"event"`
}

Jump to

Keyboard shortcuts

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