CpuKernel

Struct CpuKernel 

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

Kernel identifier.

§id_num: u64

Numeric ID for message routing.

§state: RwLock<KernelState>

Current state.

§options: LaunchOptions

Launch 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: Notify

Termination notifier.

§launched_at: Instant

Launch time.

§message_counter: AtomicU64

Message counter.

§k2k_endpoint: Mutex<Option<K2KEndpoint>>

K2K endpoint for kernel-to-kernel messaging.

Implementations§

Source§

impl CpuKernel

Source

pub fn new(id: KernelId, options: LaunchOptions, node_id: u64) -> Self

Create a new CPU kernel.

Source

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.

Source

pub fn launch(&self)

Launch the kernel (start processing).

Source

pub fn id(&self) -> &KernelId

Get kernel ID.

Source

pub fn state(&self) -> KernelState

Get current state.

Source

pub fn process_message(&self, envelope: MessageEnvelope) -> Result<()>

Process one message (for testing).

Source

pub fn handle(self: &Arc<Self>) -> KernelHandle

Create a handle to this kernel.

Source

pub fn is_k2k_enabled(&self) -> bool

Check if K2K messaging is enabled for this kernel.

Source

pub async fn k2k_send( &self, destination: KernelId, envelope: MessageEnvelope, ) -> Result<DeliveryReceipt>

Send a K2K message to another kernel.

Source

pub fn k2k_try_recv(&self) -> Option<K2KMessage>

Try to receive a K2K message (non-blocking).

Source

pub async fn k2k_recv(&self) -> Option<K2KMessage>

Receive a K2K message (blocking).

Trait Implementations§

Source§

impl KernelHandleInner for CpuKernel

Source§

fn kernel_id_num(&self) -> u64

Get numeric kernel ID.
Source§

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,

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,

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,

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,

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,

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,

Receive with timeout.
Source§

fn try_receive(&self) -> Result<MessageEnvelope>

Try receive (non-blocking).
Source§

fn receive_correlated<'life0, 'async_trait>( &'life0 self, correlation: CorrelationId, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<MessageEnvelope>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receive correlated response.
Source§

fn status(&self) -> KernelStatus

Get status.
Source§

fn metrics(&self) -> KernelMetrics

Get metrics.
Source§

fn wait<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Wait for termination.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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