Skip to main content

InvocationContext

Struct InvocationContext 

Source
pub struct InvocationContext { /* private fields */ }
Expand description

Kernel-owned context propagated across one native request invocation.

Implementations§

Source§

impl InvocationContext

Source

pub fn retain_execution(&self) -> Result<ExecutionLease, RuntimeFailure>

Retains execution capacity for Adapter-managed work beyond its reply. The returned lease must be settled on observed termination, not cancellation acknowledgement.

Source

pub fn new( request_id: RequestId, deadline: Option<Duration>, cancellation: CancellationToken, ) -> Self

Creates an invocation context with an absolute Driver-monotonic deadline.

Source

pub fn with_caller_instance(self, caller_instance: impl Into<String>) -> Self

Attaches the resolved Caller Plugin Instance to this context.

Source

pub fn caller_instance(&self) -> Option<&str>

Returns the Caller Plugin Instance, when the App attached one.

Source

pub const fn request_id(&self) -> RequestId

Returns the Kernel Request ID used for correlation and cancellation.

Source

pub const fn deadline(&self) -> Option<Duration>

Returns the absolute Driver-monotonic deadline, when one was supplied.

Source

pub const fn remaining_budget(&self) -> Option<Duration>

Returns the deadline budget captured immediately before provider dispatch.

A missing value means the invocation has no deadline. Adapter code can forward this relative duration across an execution boundary without learning or reproducing the Driver’s monotonic clock.

Source

pub fn cancellation(&self) -> CancellationToken

Returns the caller-owned cooperative cancellation signal.

Source

pub fn with_extension( self, key: impl Into<String>, value: Vec<u8>, ) -> Result<Self, InvocationContextError>

Adds one ordinary opaque extension without replacing an existing value.

Source

pub fn with_sealed_extension( self, extension: SealedInvocationExtension, ) -> Result<Self, InvocationContextError>

Adds one sealed extension while preserving issuer, audience, and key ownership.

Source

pub fn extension(&self, key: &str) -> Option<&[u8]>

Returns one ordinary extension’s opaque bytes.

Source

pub fn extensions(&self) -> impl Iterator<Item = &InvocationExtension>

Returns ordinary extensions in deterministic key order.

Source

pub fn sealed_extension(&self, key: &str) -> Option<&SealedInvocationExtension>

Returns one sealed extension by key.

Source

pub fn sealed_extensions( &self, ) -> impl Iterator<Item = &SealedInvocationExtension>

Returns sealed extensions in deterministic key order.

Source

pub fn for_target(self, capability_id: &str, operation: &str) -> Self

Restricts sealed extensions to one exact Capability/Operation target.

Ordinary baggage is preserved. A sealed extension whose audience does not cover the target is not disclosed to that provider.

Source

pub fn is_cancelled(&self) -> bool

Returns whether the caller has already cancelled this invocation.

Source

pub fn is_expired(&self, now: Duration) -> bool

Returns whether the context deadline has passed at a Driver instant.

Trait Implementations§

Source§

impl Clone for InvocationContext

Source§

fn clone(&self) -> InvocationContext

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 Debug for InvocationContext

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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> 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.