Live: broadcast events when dashboard is saved (#27583)
Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
This commit is contained in:
co-authored by
kay delaney
Torkel Ödegaard
parent
44c9aea28c
commit
8a5fc00330
@@ -0,0 +1,30 @@
|
||||
package models
|
||||
|
||||
import "github.com/centrifugal/centrifuge"
|
||||
|
||||
// ChannelPublisher writes data into a channel
|
||||
type ChannelPublisher func(channel string, data []byte) error
|
||||
|
||||
// ChannelHandler defines the core channel behavior
|
||||
type ChannelHandler interface {
|
||||
// This is called fast and often -- it must be synchrnozed
|
||||
GetChannelOptions(id string) centrifuge.ChannelOptions
|
||||
|
||||
// Called when a client wants to subscribe to a channel
|
||||
OnSubscribe(c *centrifuge.Client, e centrifuge.SubscribeEvent) error
|
||||
|
||||
// Called when something writes into the channel. The returned value will be broadcast if len() > 0
|
||||
OnPublish(c *centrifuge.Client, e centrifuge.PublishEvent) ([]byte, error)
|
||||
}
|
||||
|
||||
// ChannelHandlerProvider -- this should be implemented by any core feature
|
||||
type ChannelHandlerProvider interface {
|
||||
// This is called fast and often -- it must be synchrnozed
|
||||
GetHandlerForPath(path string) (ChannelHandler, error)
|
||||
}
|
||||
|
||||
// DashboardActivityChannel is a service to advertise dashboard activity
|
||||
type DashboardActivityChannel interface {
|
||||
DashboardSaved(uid string, userID int64) error
|
||||
DashboardDeleted(uid string, userID int64) error
|
||||
}
|
||||
Reference in New Issue
Block a user