server

package
v0.0.0-...-e43e0f2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
}

API implements http.Handler interface for serving the API.

func (API) ServeHTTP

func (api API) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP helps the API implement the http.Handler interface

type Broker

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

Broker is the message broker that handles broadcasting the messages to each client.

func NewBroker

func NewBroker() *Broker

NewBroker creates and initializes a new broker.

func (*Broker) AddClient

func (b *Broker) AddClient(c chan []byte)

AddClient adds a client to the broker to start receiving messages

func (*Broker) RemoveClient

func (b *Broker) RemoveClient(c chan []byte)

RemoveClient removes a client from receiving messages.

func (*Broker) Send

func (b *Broker) Send(msg []byte)

Send sends a message to all of the clients

func (*Broker) ServeHTTP

func (b *Broker) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Broker) Start

func (b *Broker) Start()

Start starts the brokers main loop

type Event

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

Event represents a server sent event(SSE)

func NewEvent

func NewEvent(id, event string, data []byte) Event

NewEvent initializes an event from its component parts

func (Event) ToBytes

func (e Event) ToBytes() []byte

ToBytes returns the event as a byte slice.

type Eventer

type Eventer interface {
	ToEvent() Event
}

type JobsStatus

type JobsStatus struct {
	Context string   `json:"context"`
	Jobs    []v1.Job `json:"jobs"`
}

JobsStatus is the data structure to hold the data that will be returned for all the jobs

func (JobsStatus) ToEvent

func (js JobsStatus) ToEvent() Event

ToEvent creates a (Server Sent) Event for the JobsStatus

type PodsStatus

type PodsStatus struct {
	Context string   `json:"context"`
	Pods    []v1.Pod `json:"pods"`
}

PodsStatus is the data structure to hold the data that will be returned for all the pods

func (PodsStatus) ToEvent

func (ps PodsStatus) ToEvent() Event

ToEvent creates a (Server Sent) Event for the PodsStatus

type ServicesStatus

type ServicesStatus struct {
	Context  string       `json:"context"`
	Services []v1.Service `json:"services"`
}

ServicesStatus is the data structure to hold the data that will be returned for all the services

func (ServicesStatus) ToEvent

func (ss ServicesStatus) ToEvent() Event

ToEvent creates a (Server Sent) Event for the ServicesStatus

type StatusServer

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

StatusServer will be responsible for serving our very basic index page, its assets, and the broadcasting the server sent events.

func NewStatusServer

func NewStatusServer(port int) *StatusServer

NewStatusServer creates and initializes a new StatusServer

func (*StatusServer) Start

func (s *StatusServer) Start()

Start starts the StatusServer

Jump to

Keyboard shortcuts

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