Skip to main content

Instance

Trait Instance 

Source
pub trait Instance:
    Send
    + Sync
    + 'static {
    type InvokeStream: Stream<Item = Result<InstanceInvokeResponse, Status>> + Send + 'static;
    type SamplesStream: Stream<Item = Result<InstanceSamplesResponse, Status>> + Send + 'static;

    // Required methods
    fn get<'life0, 'async_trait>(
        &'life0 self,
        request: Request<InstanceGetRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<InstanceGetResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn invoke<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Streaming<InstanceInvokeRequest>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::InvokeStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn samples<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Streaming<InstanceSamplesRequest>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::SamplesStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
        request: Request<InstanceStopRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<InstanceStopResponse>, 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 InstanceServer.

Required Associated Types§

Source

type InvokeStream: Stream<Item = Result<InstanceInvokeResponse, Status>> + Send + 'static

Server streaming response type for the Invoke method.

Source

type SamplesStream: Stream<Item = Result<InstanceSamplesResponse, Status>> + Send + 'static

Server streaming response type for the Samples method.

Required Methods§

Source

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

Identity, start time and declarations. Called once per connection, first.

Source

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

One invocation of one operation. The host opens the call with a harmos.plugin.v1.Request. While it runs, the plugin may send harmos.plugin.v1.ChildRequest frames and the host answers each with a harmos.plugin.v1.ChildResponse. The plugin ends the call with a harmos.plugin.v1.Response. The host may send harmos.plugin.v1.Cancel at any time.

Source

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

One declared stream or collection, selected by its lexicographically first member. The host opens with SamplesSelection. Device streams take demand from open/close; interval observers take sampling demand from CollectionDemand, acknowledged after first-demand start or last-demand stop hooks. Collections select their listened members. For a stream with an interval the host then grants harmos.plugin.v1.Window frames and the plugin answers with SampleBatch column parts or one CollectionBatch per tick; the final part or tick is marked last. Only one window may be unanswered. Between receiving a window and sending its last part, the plugin may send ChildRequest, ChildDemand and ChildCancel frames; the host replies with ChildResponse on this same stream. Child calls inherit SamplesSelection.scope and the admitted plugin’s caller context and grants, with the same routing and policy checks as Invoke. Replies may arrive out of order and are matched by call ID, unique for the whole Samples call, not reused on later windows. Failures retain every field unchanged. Answering the window or ending the stream cancels its outstanding children and suppresses their later replies. ChildCancel does the same for its child only. Child traffic outside an unanswered window (including device streams), unknown or duplicate terminal reply IDs, and mixed sample/child responses are refused with INVALID_ARGUMENT.

Source

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

Sent only to a process the host spawned and still owns, before shutdown or removal. The plugin completes process cleanup and replies; the host awaits exit and reaps it. Detaching an externally spawned process closes only the host connection, without Stop, even when launch credentials were used.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§