dashboard

package
v0.0.0-...-76fd9b3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDashboard

func NewDashboard(topic string, conn *websocket.Conn) error

NewDashboard

func RegisterTopic

func RegisterTopic(topic DSTopic) error

RegisterTopic registers a topic

func SetOptions

func SetOptions(options *DSOptions)

SetOptions sets dashboard configuration options

Types

type DSClientId

type DSClientId uint32

DSClientId dashboard client id

type DSEventQ

type DSEventQ chan TopicEvent

DSEventQ topic event queue

type DSOptions

type DSOptions struct {
	DataBacklog       *int
	PublishLatestData *bool
}

DSOptions dashboard configuration options

type DSTopic

type DSTopic interface {
	// GetTopic gets topic id
	GetTopic() string

	// Listen listens for event change, any change should be pushed to DSEventQ
	Listen(q DSEventQ) error

	// React reacts for event change, and returns processed data to push to frontend
	React(event TopicEvent) (string, error)
}

DSTopic defines dashboard topic interface

type MockDSTopic

type MockDSTopic struct {
	mock.Mock
	EventSchedule time.Duration
}

func (*MockDSTopic) GetTopic

func (m *MockDSTopic) GetTopic() string

func (*MockDSTopic) Listen

func (m *MockDSTopic) Listen(q DSEventQ) error

func (*MockDSTopic) React

func (m *MockDSTopic) React(event TopicEvent) (string, error)

type TopicEvent

type TopicEvent interface{}

TopicEvent topic change event data type

Jump to

Keyboard shortcuts

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