Skip to main content

Kernel

Struct Kernel 

Source
pub struct Kernel<P: Platform> { /* private fields */ }
Expand description

The WeftOS kernel.

Wraps AppContext<P> in a managed boot sequence with process tracking, service lifecycle, IPC, and health monitoring.

§Lifecycle

  1. Call Kernel::boot to initialize all subsystems.
  2. The kernel transitions from Booting -> Running.
  3. Call Kernel::shutdown to gracefully stop everything.
  4. The kernel transitions from Running -> ShuttingDown -> Halted.

Implementations§

Source§

impl<P: Platform> Kernel<P>

Source

pub async fn boot( config: Config, kernel_config: KernelConfig, platform: Arc<P>, ) -> KernelResult<Self>

Boot the kernel from configuration and platform.

This is the primary entry point. It:

  1. Creates subsystems (process table, service registry, IPC, health)
  2. Creates AppContext (reuses existing bootstrap)
  3. Registers the kernel process (PID 0)
  4. Starts all registered services
  5. Transitions to Running state
§Errors

Returns KernelError::Boot if any critical subsystem fails to initialize.

Source

pub async fn shutdown(&mut self) -> KernelResult<()>

Shut down the kernel gracefully.

Stops all services, cancels all processes, and transitions to the Halted state.

Source

pub fn state(&self) -> &KernelState

Get the current kernel state.

Source

pub fn kernel_config(&self) -> &KernelConfig

Get the kernel configuration.

Source

pub fn process_table(&self) -> &Arc<ProcessTable>

Get the process table.

Source

pub fn services(&self) -> &Arc<ServiceRegistry>

Get the service registry.

Source

pub fn ipc(&self) -> &Arc<KernelIpc>

Get the IPC subsystem.

Source

pub fn bus(&self) -> &Arc<MessageBus>

Get the message bus.

Source

pub fn a2a_router(&self) -> &Arc<A2ARouter>

Get the A2A router.

Source

pub fn cron_service(&self) -> &Arc<CronService>

Get the cron service.

Source

pub fn health(&self) -> &HealthSystem

Get the health system.

Source

pub fn supervisor(&self) -> &AgentSupervisor<P>

Get the agent supervisor.

Source

pub fn boot_log(&self) -> &BootLog

Get the boot log.

Source

pub fn event_log(&self) -> &Arc<KernelEventLog>

Get the runtime event log (ring buffer).

Source

pub fn uptime(&self) -> Duration

Get kernel uptime.

Source

pub fn cluster_membership(&self) -> &Arc<ClusterMembership>

Get the cluster membership tracker.

Source

pub fn chain_manager(&self) -> Option<&Arc<ChainManager>>

Get the local chain manager (when exochain feature is enabled).

Source

pub fn tree_manager(&self) -> Option<&Arc<TreeManager>>

Get the tree manager (when exochain feature is enabled).

Source

pub fn governance_gate(&self) -> Option<&Arc<dyn GateBackend>>

Get the governance gate backend (if configured).

Source

pub fn ecc_hnsw(&self) -> Option<&Arc<HnswService>>

Get the ECC HNSW service (if ecc feature enabled).

Source

pub fn ecc_causal(&self) -> Option<&Arc<CausalGraph>>

Get the ECC causal graph (if ecc feature enabled).

Source

pub fn ecc_tick(&self) -> Option<&Arc<CognitiveTick>>

Get the ECC cognitive tick (if ecc feature enabled).

Source

pub fn ecc_calibration(&self) -> Option<&EccCalibration>

Get the ECC calibration results (if ecc feature enabled).

Source

pub fn ecc_crossrefs(&self) -> Option<&Arc<CrossRefStore>>

Get the ECC cross-reference store (if ecc feature enabled).

Source

pub fn ecc_impulses(&self) -> Option<&Arc<ImpulseQueue>>

Get the ECC impulse queue (if ecc feature enabled).

Source

pub fn take_app_context(&mut self) -> Option<AppContext<P>>

Take ownership of the AppContext for agent loop consumption.

This is a one-shot operation: after calling this, the kernel no longer holds the AppContext. Use this before calling AppContext::into_agent_loop().

Auto Trait Implementations§

§

impl<P> Freeze for Kernel<P>

§

impl<P> !RefUnwindSafe for Kernel<P>

§

impl<P> Send for Kernel<P>

§

impl<P> Sync for Kernel<P>

§

impl<P> Unpin for Kernel<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for Kernel<P>

§

impl<P> !UnwindSafe for Kernel<P>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

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

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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