live

package
v0.0.0-...-8eaa7ac Latest Latest
Warning

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

Go to latest
Published: Nov 28, 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 "grafana", "ds", or "plugin".
	Scope string `json:"scope,omitempty"`

	// Namespace meaning depends on the scope.
	// * when grafana, 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 CoreGrafanaScope

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

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

CoreGrafanaScope list of core features

type GrafanaLive

type GrafanaLive struct {
	Cfg           *setting.Cfg          `inject:""`
	RouteRegister routing.RouteRegister `inject:""`

	// The websocket handler
	WebsocketHandler interface{}

	// The core internal features
	GrafanaScope CoreGrafanaScope
	// contains filtered or unexported fields
}

GrafanaLive pretends to be the server

func (*GrafanaLive) GetChannelHandler

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

GetChannelHandler gives threadsafe access to the channel

func (*GrafanaLive) GetChannelHandlerFactory

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

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

func (*GrafanaLive) Init

func (g *GrafanaLive) Init() error

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

func (*GrafanaLive) IsEnabled

func (g *GrafanaLive) IsEnabled() bool

IsEnabled returns true if the Grafana Live feature is enabled.

func (*GrafanaLive) Publish

func (g *GrafanaLive) 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 `grafana/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