events

package
v0.0.0-...-a810e79 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
}

Handler describes an event handler.

func NewEventHandler

func NewEventHandler() *Handler

NewEventHandler creates and returns a new event handler.

func (Handler) Log

func (h Handler) Log(r *log.Record) error

Log sends a new logging event.

type Listener

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

Listener describes an event listener.

func (*Listener) Connection

func (e *Listener) Connection() *websocket.Conn

Connection returns the underlying websocket connection.

func (*Listener) Deactivate

func (e *Listener) Deactivate()

Deactivate deactivates the event listener.

func (*Listener) ID

func (e *Listener) ID() string

ID returns the listener ID.

func (*Listener) IsDone

func (e *Listener) IsDone() bool

IsDone returns true if the listener is done.

func (*Listener) Lock

func (e *Listener) Lock()

Lock locks the internal mutex.

func (*Listener) MessageTypes

func (e *Listener) MessageTypes() []string

MessageTypes returns a list of message types the listener will be notified of.

func (*Listener) Unlock

func (e *Listener) Unlock()

Unlock unlocks the internal mutex.

func (*Listener) Wait

func (e *Listener) Wait(ctx context.Context)

Wait waits for a message on its active channel or the context is cancelled, then returns.

type Server

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

Server represents an instance of an event server.

var LoggingServer *Server

LoggingServer controls what server to use for messages coming from the logger.

func NewServer

func NewServer(debug bool, verbose bool) *Server

NewServer returns a new event server.

func (*Server) AddListener

func (s *Server) AddListener(group string, connection *websocket.Conn, messageTypes []string, location string, noForward bool) (*Listener, error)

AddListener creates and returns a new event listener.

func (*Server) Forward

func (s *Server) Forward(id int64, event api.Event)

Forward to the local events dispatcher an event received from another node.

func (*Server) Send

func (s *Server) Send(group, eventType string, eventMessage interface{}) error

Send broadcasts a custom event.

func (*Server) SendLifecycle

func (s *Server) SendLifecycle(group, action, source string,
	context map[string]interface{}) error

SendLifecycle broadcasts a lifecycle event.

Jump to

Keyboard shortcuts

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