live

package
v0.0.0-...-900be4e Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelAddress

type ChannelAddress struct {
	// Scope is "grafarg", "ds", or "plugin".
	Scope string `json:"scope,omitempty"`

	// Namespace meaning depends on the scope.
	// * when grafarg, namespace is a "feature"
	// * when ds, namespace is the datasource id
	// * when plugin, namespace is the plugin name
	Namespace string `json:"namespace,omitempty"`

	// Within each namespace, the handler can process the path as needed.
	Path string `json:"path,omitempty"`
}

ChannelAddress is the channel ID split by parts.

func ParseChannelAddress

func ParseChannelAddress(id string) ChannelAddress

ParseChannelAddress parses the parts from a channel ID:

${scope} / ${namespace} / ${path}.

func (*ChannelAddress) IsValid

func (ca *ChannelAddress) IsValid() bool

IsValid checks if all parts of the address are valid.

type CoreGrafargScope

type CoreGrafargScope struct {
	Features map[string]models.ChannelHandlerFactory

	// The generic service to advertise dashboard changes
	Dashboards models.DashboardActivityChannel
}

CoreGrafargScope list of core features

type GrafargLive

type GrafargLive struct {
	Cfg           *setting.Cfg            `inject:""`
	RouteRegister routing.RouteRegister   `inject:""`
	LogsService   *cloudwatch.LogsService `inject:""`

	// The websocket handler
	WebsocketHandler interface{}

	// The core internal features
	GrafargScope CoreGrafargScope
	// contains filtered or unexported fields
}

GrafargLive pretends to be the server

func (*GrafargLive) GetChannelHandler

func (g *GrafargLive) GetChannelHandler(channel string) (models.ChannelHandler, error)

GetChannelHandler gives threadsafe access to the channel

func (*GrafargLive) GetChannelHandlerFactory

func (g *GrafargLive) GetChannelHandlerFactory(scope string, name string) (models.ChannelHandlerFactory, error)

GetChannelHandlerFactory gets a ChannelHandlerFactory for a namespace. It gives threadsafe access to the channel.

func (*GrafargLive) Init

func (g *GrafargLive) Init() error

Init initializes the instance. Required to implement the registry.Service interface.

func (*GrafargLive) IsEnabled

func (g *GrafargLive) IsEnabled() bool

IsEnabled returns true if the Grafarg Live feature is enabled.

func (*GrafargLive) Publish

func (g *GrafargLive) Publish(channel string, data []byte) error

Publish sends the data to the channel without checking permissions etc

type PluginHandler

type PluginHandler struct {
	Plugin *plugins.PluginBase
}

PluginHandler manages all the `grafarg/dashboard/*` channels

func (*PluginHandler) GetHandlerForPath

func (h *PluginHandler) GetHandlerForPath(path string) (models.ChannelHandler, error)

GetHandlerForPath called on init

func (*PluginHandler) OnPublish

OnPublish checks if a message from the websocket can be broadcast on this channel

func (*PluginHandler) OnSubscribe

OnSubscribe for now allows anyone to subscribe

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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