pub struct InvocationContext { /* private fields */ }Expand description
Kernel-owned context propagated across one native request invocation.
Implementations§
Source§impl InvocationContext
impl InvocationContext
Sourcepub fn new(
request_id: RequestId,
deadline: Option<Duration>,
cancellation: CancellationToken,
) -> Self
pub fn new( request_id: RequestId, deadline: Option<Duration>, cancellation: CancellationToken, ) -> Self
Creates an invocation context with an absolute Driver-monotonic deadline.
Sourcepub fn with_caller_instance(self, caller_instance: impl Into<String>) -> Self
pub fn with_caller_instance(self, caller_instance: impl Into<String>) -> Self
Attaches the resolved Caller Module Instance to this context.
Sourcepub fn caller_instance(&self) -> Option<&str>
pub fn caller_instance(&self) -> Option<&str>
Returns the Caller Module Instance, when the App attached one.
Sourcepub const fn request_id(&self) -> RequestId
pub const fn request_id(&self) -> RequestId
Returns the Kernel Request ID used for correlation and cancellation.
Sourcepub const fn deadline(&self) -> Option<Duration>
pub const fn deadline(&self) -> Option<Duration>
Returns the absolute Driver-monotonic deadline, when one was supplied.
Sourcepub fn cancellation(&self) -> CancellationToken
pub fn cancellation(&self) -> CancellationToken
Returns the caller-owned cooperative cancellation signal.
Sourcepub fn with_extension(
self,
key: impl Into<String>,
value: Vec<u8>,
) -> Result<Self, InvocationContextError>
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.
Sourcepub fn with_sealed_extension(
self,
extension: SealedInvocationExtension,
) -> Result<Self, InvocationContextError>
pub fn with_sealed_extension( self, extension: SealedInvocationExtension, ) -> Result<Self, InvocationContextError>
Adds one sealed extension while preserving issuer, audience, and key ownership.
Sourcepub fn extension(&self, key: &str) -> Option<&[u8]>
pub fn extension(&self, key: &str) -> Option<&[u8]>
Returns one ordinary extension’s opaque bytes.
Sourcepub fn extensions(&self) -> impl Iterator<Item = &InvocationExtension>
pub fn extensions(&self) -> impl Iterator<Item = &InvocationExtension>
Returns ordinary extensions in deterministic key order.
Sourcepub fn sealed_extension(&self, key: &str) -> Option<&SealedInvocationExtension>
pub fn sealed_extension(&self, key: &str) -> Option<&SealedInvocationExtension>
Returns one sealed extension by key.
Sourcepub fn sealed_extensions(
&self,
) -> impl Iterator<Item = &SealedInvocationExtension>
pub fn sealed_extensions( &self, ) -> impl Iterator<Item = &SealedInvocationExtension>
Returns sealed extensions in deterministic key order.
Sourcepub fn for_target(self, capability_id: &str, operation: &str) -> Self
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.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns whether the caller has already cancelled this invocation.
Sourcepub fn is_expired(&self, now: Duration) -> bool
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
impl Clone for InvocationContext
Source§fn clone(&self) -> InvocationContext
fn clone(&self) -> InvocationContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more