Documentation ¶
Index ¶
- type ChannelAddress
- type CoreGrafargScope
- type GrafargLive
- func (g *GrafargLive) GetChannelHandler(channel string) (models.ChannelHandler, error)
- func (g *GrafargLive) GetChannelHandlerFactory(scope string, name string) (models.ChannelHandlerFactory, error)
- func (g *GrafargLive) Init() error
- func (g *GrafargLive) IsEnabled() bool
- func (g *GrafargLive) Publish(channel string, data []byte) error
- type PluginHandler
- func (h *PluginHandler) GetHandlerForPath(path string) (models.ChannelHandler, error)
- func (h *PluginHandler) OnPublish(c *centrifuge.Client, e centrifuge.PublishEvent) (centrifuge.PublishReply, error)
- func (h *PluginHandler) OnSubscribe(c *centrifuge.Client, e centrifuge.SubscribeEvent) (centrifuge.SubscribeReply, error)
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.
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 ¶
func (h *PluginHandler) OnPublish(c *centrifuge.Client, e centrifuge.PublishEvent) (centrifuge.PublishReply, error)
OnPublish checks if a message from the websocket can be broadcast on this channel
func (*PluginHandler) OnSubscribe ¶
func (h *PluginHandler) OnSubscribe(c *centrifuge.Client, e centrifuge.SubscribeEvent) (centrifuge.SubscribeReply, error)
OnSubscribe for now allows anyone to subscribe