Skip to main content

InstanceClient

Struct InstanceClient 

Source
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>

Source

pub async fn connect<D>(dst: D) -> Result<Self, Error>
where D: TryInto<Endpoint>, D::Error: Into<StdError>,

Attempt to create a new client by connecting to a given endpoint.

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,

Source

pub fn new(inner: T) -> Self

Source

pub fn with_origin(inner: T, origin: Uri) -> Self

Source

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,

Source

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.

Source

pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self

Enable decompressing responses.

Source

pub fn max_decoding_message_size(self, limit: usize) -> Self

Limits the maximum size of a decoded message.

Default: 4MB

Source

pub fn max_encoding_message_size(self, limit: usize) -> Self

Limits the maximum size of an encoded message.

Default: usize::MAX

Source

pub async fn get( &mut self, request: impl IntoRequest<InstanceGetRequest>, ) -> Result<Response<InstanceGetResponse>, Status>

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

Source

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.

Source

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.

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for InstanceClient<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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>
where T: Send, BoxRaw<ByteStr>: Send, Bytes: Send,

§

impl<T> Sync for InstanceClient<T>
where T: Sync, BoxRaw<ByteStr>: Sync, Bytes: Sync,

§

impl<T> Unpin for InstanceClient<T>
where T: Unpin, Box<ByteStr>: Unpin, *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more