pub struct InstanceClient<T> { /* private fields */ }Expand description
Serves one running plugin to its host over the plugin face; each connection receives its own host activation.
Implementations§
Source§impl InstanceClient<Channel>
impl InstanceClient<Channel>
Source§impl<T> InstanceClient<T>where
T: GrpcService<Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<T> InstanceClient<T>where
T: GrpcService<Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
pub fn new(inner: T) -> Self
pub fn with_origin(inner: T, origin: Uri) -> Self
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InstanceClient<InterceptedService<T, F>>where
F: Interceptor,
T::ResponseBody: Default,
T: Service<Request<Body>, Response = Response<<T as GrpcService<Body>>::ResponseBody>>,
<T as Service<Request<Body>>>::Error: Into<StdError> + Send + Sync,
Sourcepub fn send_compressed(self, encoding: CompressionEncoding) -> Self
pub fn send_compressed(self, encoding: CompressionEncoding) -> Self
Compress requests with the given encoding.
This requires the server to support it otherwise it might respond with an error.
Sourcepub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
Enable decompressing responses.
Sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
Sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
Sourcepub async fn get(
&mut self,
request: impl IntoRequest<InstanceGetRequest>,
) -> Result<Response<InstanceGetResponse>, Status>
pub async fn get( &mut self, request: impl IntoRequest<InstanceGetRequest>, ) -> Result<Response<InstanceGetResponse>, Status>
Identity, start time and declarations. Called once per connection, first.
Sourcepub async fn invoke(
&mut self,
request: impl IntoStreamingRequest<Message = InstanceInvokeRequest>,
) -> Result<Response<Streaming<InstanceInvokeResponse>>, Status>
pub async fn invoke( &mut self, request: impl IntoStreamingRequest<Message = InstanceInvokeRequest>, ) -> Result<Response<Streaming<InstanceInvokeResponse>>, Status>
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.
Sourcepub async fn samples(
&mut self,
request: impl IntoStreamingRequest<Message = InstanceSamplesRequest>,
) -> Result<Response<Streaming<InstanceSamplesResponse>>, Status>
pub async fn samples( &mut self, request: impl IntoStreamingRequest<Message = InstanceSamplesRequest>, ) -> Result<Response<Streaming<InstanceSamplesResponse>>, Status>
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.
Sourcepub async fn stop(
&mut self,
request: impl IntoRequest<InstanceStopRequest>,
) -> Result<Response<InstanceStopResponse>, Status>
pub async fn stop( &mut self, request: impl IntoRequest<InstanceStopRequest>, ) -> Result<Response<InstanceStopResponse>, Status>
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.
Trait Implementations§
Source§impl<T: Clone> Clone for InstanceClient<T>
impl<T: Clone> Clone for InstanceClient<T>
Auto Trait Implementations§
impl<T> !Freeze for InstanceClient<T>
impl<T> Forget for InstanceClient<T>
impl<T> Move for InstanceClient<T>
impl<T> RefUnwindSafe for InstanceClient<T>
impl<T> Send for InstanceClient<T>
impl<T> Sync for InstanceClient<T>
impl<T> Unpin for InstanceClient<T>
impl<T> UnsafeUnpin for InstanceClient<T>where
T: UnsafeUnpin,
*const ByteStr is !null: UnsafeUnpin,
PhantomData<ByteStr>: UnsafeUnpin,
*const u8: UnsafeUnpin,
Align8<*mut ()>: UnsafeUnpin,
&'static Vtable: UnsafeUnpin,
impl<T> UnwindSafe for InstanceClient<T>where
T: UnwindSafe,
BoxRaw<ByteStr>: UnwindSafe,
*const u8: UnwindSafe,
Align8<*mut ()>: UnwindSafe,
&'static Vtable: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request