pub struct KernelHandle { /* private fields */ }Expand description
Handle to a launched kernel.
Provides an ergonomic API for interacting with a kernel.
Implementations§
Source§impl KernelHandle
impl KernelHandle
Sourcepub fn new(id: KernelId, inner: Arc<dyn KernelHandleInner>) -> KernelHandle
pub fn new(id: KernelId, inner: Arc<dyn KernelHandleInner>) -> KernelHandle
Create a new kernel handle.
Sourcepub async fn activate(&self) -> Result<(), RingKernelError>
pub async fn activate(&self) -> Result<(), RingKernelError>
Activate the kernel.
Sourcepub async fn deactivate(&self) -> Result<(), RingKernelError>
pub async fn deactivate(&self) -> Result<(), RingKernelError>
Deactivate the kernel.
Sourcepub async fn terminate(&self) -> Result<(), RingKernelError>
pub async fn terminate(&self) -> Result<(), RingKernelError>
Terminate the kernel.
Sourcepub async fn send<M>(&self, message: M) -> Result<(), RingKernelError>where
M: RingMessage,
pub async fn send<M>(&self, message: M) -> Result<(), RingKernelError>where
M: RingMessage,
Send a message to the kernel.
Sourcepub async fn send_envelope(
&self,
envelope: MessageEnvelope,
) -> Result<(), RingKernelError>
pub async fn send_envelope( &self, envelope: MessageEnvelope, ) -> Result<(), RingKernelError>
Send a raw envelope.
Sourcepub async fn receive(&self) -> Result<MessageEnvelope, RingKernelError>
pub async fn receive(&self) -> Result<MessageEnvelope, RingKernelError>
Receive a message from the kernel.
Sourcepub async fn receive_timeout(
&self,
timeout: Duration,
) -> Result<MessageEnvelope, RingKernelError>
pub async fn receive_timeout( &self, timeout: Duration, ) -> Result<MessageEnvelope, RingKernelError>
Receive a message with timeout.
Sourcepub fn try_receive(&self) -> Result<MessageEnvelope, RingKernelError>
pub fn try_receive(&self) -> Result<MessageEnvelope, RingKernelError>
Try to receive a message (non-blocking).
Sourcepub async fn call<M>(
&self,
message: M,
timeout: Duration,
) -> Result<MessageEnvelope, RingKernelError>where
M: RingMessage,
pub async fn call<M>(
&self,
message: M,
timeout: Duration,
) -> Result<MessageEnvelope, RingKernelError>where
M: RingMessage,
Send request and wait for response (call pattern).
Sourcepub fn status(&self) -> KernelStatus
pub fn status(&self) -> KernelStatus
Get kernel status.
Sourcepub fn metrics(&self) -> KernelMetrics
pub fn metrics(&self) -> KernelMetrics
Get kernel metrics.
Sourcepub async fn wait(&self) -> Result<(), RingKernelError>
pub async fn wait(&self) -> Result<(), RingKernelError>
Wait for kernel to terminate.
Sourcepub fn state(&self) -> KernelState
pub fn state(&self) -> KernelState
Get the current kernel state.
This is a convenience method that returns just the state from status().
Sourcepub async fn suspend(&self) -> Result<(), RingKernelError>
pub async fn suspend(&self) -> Result<(), RingKernelError>
Suspend (deactivate) the kernel.
This is an alias for deactivate() for more intuitive API usage.
Sourcepub async fn resume(&self) -> Result<(), RingKernelError>
pub async fn resume(&self) -> Result<(), RingKernelError>
Resume (activate) the kernel.
This is an alias for activate() for more intuitive API usage.
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
Check if the kernel has terminated.
Trait Implementations§
Source§impl Clone for KernelHandle
impl Clone for KernelHandle
Source§fn clone(&self) -> KernelHandle
fn clone(&self) -> KernelHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more