pub struct CpuKernel {Show 14 fields
id: KernelId,
id_num: u64,
state: RwLock<KernelState>,
options: LaunchOptions,
control: RwLock<ControlBlock>,
telemetry: RwLock<TelemetryBuffer>,
input_queue: Arc<BoundedQueue>,
output_queue: Arc<BoundedQueue>,
clock: Arc<HlcClock>,
correlation_waiters: Mutex<HashMap<u64, Sender<MessageEnvelope>>>,
terminate_notify: Notify,
launched_at: Instant,
message_counter: AtomicU64,
k2k_endpoint: Mutex<Option<K2KEndpoint>>,
}Expand description
CPU-based kernel implementation.
Fields§
§id: KernelIdKernel identifier.
id_num: u64Numeric ID for message routing.
state: RwLock<KernelState>Current state.
options: LaunchOptionsLaunch options.
control: RwLock<ControlBlock>Control block.
telemetry: RwLock<TelemetryBuffer>Telemetry buffer.
input_queue: Arc<BoundedQueue>Input queue (host -> kernel).
output_queue: Arc<BoundedQueue>Output queue (kernel -> host).
clock: Arc<HlcClock>HLC clock.
correlation_waiters: Mutex<HashMap<u64, Sender<MessageEnvelope>>>Correlation waiters.
terminate_notify: NotifyTermination notifier.
launched_at: InstantLaunch time.
message_counter: AtomicU64Message counter.
k2k_endpoint: Mutex<Option<K2KEndpoint>>K2K endpoint for kernel-to-kernel messaging.
Implementations§
Source§impl CpuKernel
impl CpuKernel
Sourcepub fn new(id: KernelId, options: LaunchOptions, node_id: u64) -> Self
pub fn new(id: KernelId, options: LaunchOptions, node_id: u64) -> Self
Create a new CPU kernel.
Sourcepub fn new_with_k2k(
id: KernelId,
options: LaunchOptions,
node_id: u64,
k2k_endpoint: Option<K2KEndpoint>,
) -> Self
pub fn new_with_k2k( id: KernelId, options: LaunchOptions, node_id: u64, k2k_endpoint: Option<K2KEndpoint>, ) -> Self
Create a new CPU kernel with optional K2K endpoint.
Sourcepub fn process_message(&self, envelope: MessageEnvelope) -> Result<()>
pub fn process_message(&self, envelope: MessageEnvelope) -> Result<()>
Process one message (for testing).
Sourcepub fn is_k2k_enabled(&self) -> bool
pub fn is_k2k_enabled(&self) -> bool
Check if K2K messaging is enabled for this kernel.
Sourcepub async fn k2k_send(
&self,
destination: KernelId,
envelope: MessageEnvelope,
) -> Result<DeliveryReceipt>
pub async fn k2k_send( &self, destination: KernelId, envelope: MessageEnvelope, ) -> Result<DeliveryReceipt>
Send a K2K message to another kernel.
Sourcepub fn k2k_try_recv(&self) -> Option<K2KMessage>
pub fn k2k_try_recv(&self) -> Option<K2KMessage>
Try to receive a K2K message (non-blocking).
Trait Implementations§
Source§impl KernelHandleInner for CpuKernel
impl KernelHandleInner for CpuKernel
Source§fn kernel_id_num(&self) -> u64
fn kernel_id_num(&self) -> u64
Get numeric kernel ID.
Source§fn current_timestamp(&self) -> HlcTimestamp
fn current_timestamp(&self) -> HlcTimestamp
Get current timestamp.
Source§fn activate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn activate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Activate kernel.
Source§fn deactivate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn deactivate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deactivate kernel.
Source§fn terminate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn terminate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Terminate kernel.
Source§fn send_envelope<'life0, 'async_trait>(
&'life0 self,
envelope: MessageEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_envelope<'life0, 'async_trait>(
&'life0 self,
envelope: MessageEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send message envelope.
Source§fn receive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<MessageEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<MessageEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive message.
Source§fn receive_timeout<'life0, 'async_trait>(
&'life0 self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<MessageEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive_timeout<'life0, 'async_trait>(
&'life0 self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<MessageEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive with timeout.
Source§fn try_receive(&self) -> Result<MessageEnvelope>
fn try_receive(&self) -> Result<MessageEnvelope>
Try receive (non-blocking).
Receive correlated response.
Auto Trait Implementations§
impl !Freeze for CpuKernel
impl !RefUnwindSafe for CpuKernel
impl Send for CpuKernel
impl Sync for CpuKernel
impl Unpin for CpuKernel
impl !UnwindSafe for CpuKernel
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.