Struct grafana_plugin_sdk::live::Channel [−][src]
pub struct Channel { /* fields omitted */ }
Expand description
The identifier of a pub/sub channel in Grafana Live.
Channels are represented as /
delimited strings containing their three components,
and can be parsed from such strings using str::parse
.
When included in the Metadata
of a Frame
,
channels are (de)serialized from this format.
// Note that the 'path' can contain '/'s.
let channel: Channel = "plugin/my-cool-plugin/streams/custom-streaming-feature"
.parse()
.expect("valid channel");
assert_eq!(channel.scope(), Scope::Plugin);
assert_eq!(channel.namespace().as_str(), "my-cool-plugin");
assert_eq!(channel.path().as_str(), "streams/custom-streaming-feature");
assert_eq!(
channel.to_string(),
String::from("plugin/my-cool-plugin/streams/custom-streaming-feature"),
);
See the channel guide for more information.
Implementations
Create a new channel from pre-validated parts.
Get the scope of this channel.
The scope determines the purpose of the channel; for example, channels used
internally by Grafana have scope Grafana
, while channels
used by datasource plugins have scope Datasource
.
Get the namespace of this channel.
The namespace has a different meaning depending on scope:
- when scope is
Scope::Grafana
, namespace is a “feature” - when scope is
Scope::Plugin
, namespace is the plugin name - when scope is
Scope::Datasource
, namespace is the datasourceuid
. - when scope is
Scope::Stream
, namespace is the stream ID.
For example, scope Grafana
could have a namespace called dashboard
,
and all messages on such a channel would related to real-time dashboard events.
Get the path of this channel.
The path usually contains the identifier of some concrete resource within a namespace, such as the ID of a dashboard that a user is currently looking at.
This can be anything the plugin author desires, provided it only includes the characters
defined in the Path
documentation.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Channel
impl UnwindSafe for Channel
Blanket Implementations
Mutably borrows from an owned value. Read more
Wrap the input message T
in a tonic::Request
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more