pub trait Stream: Send + Sync + 'static {
    type RunStreamStream: Stream<Item = Result<StreamPacket, Status>> + Send + 'static;

    // Required methods
    fn subscribe_stream<'life0, 'async_trait>(
        &'life0 self,
        request: Request<SubscribeStreamRequest>
    ) -> Pin<Box<dyn Future<Output = Result<Response<SubscribeStreamResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn run_stream<'life0, 'async_trait>(
        &'life0 self,
        request: Request<RunStreamRequest>
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::RunStreamStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_stream<'life0, 'async_trait>(
        &'life0 self,
        request: Request<PublishStreamRequest>
    ) -> Pin<Box<dyn Future<Output = Result<Response<PublishStreamResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with StreamServer.

Required Associated Types§

source

type RunStreamStream: Stream<Item = Result<StreamPacket, Status>> + Send + 'static

Server streaming response type for the RunStream method.

Required Methods§

source

fn subscribe_stream<'life0, 'async_trait>( &'life0 self, request: Request<SubscribeStreamRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<SubscribeStreamResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SubscribeStream called when a user tries to subscribe to a plugin/datasource managed channel path – thus plugin can check subscribe permissions and communicate options with Grafana Core. When the first subscriber joins a channel, RunStream will be called.

source

fn run_stream<'life0, 'async_trait>( &'life0 self, request: Request<RunStreamRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::RunStreamStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

RunStream will be initiated by Grafana to consume a stream. RunStream will be called once for the first client successfully subscribed to a channel path. When Grafana detects that there are no longer any subscribers inside a channel, the call will be terminated until next active subscriber appears. Call termination can happen with a delay.

source

fn publish_stream<'life0, 'async_trait>( &'life0 self, request: Request<PublishStreamRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<PublishStreamResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

PublishStream called when a user tries to publish to a plugin/datasource managed channel path. Here plugin can check publish permissions and modify publication data if required.

Implementors§

source§

impl<T> Stream for T
where T: Send + Sync + StreamService + 'static,