Skip to main content

CanonicalKernel

Struct CanonicalKernel 

Source
pub struct CanonicalKernel { /* private fields */ }
Expand description

One canonical operation driven exclusively through the durable transition protocol.

The type is deliberately not Clone: duplicating a live candidate would make two handles able to commit the same prepare token. Rebuild instead uses Self::restore or Self::restore_bytes, both of which replace this handle’s internals in place.

Implementations§

Source§

impl CanonicalKernel

Source

pub fn new(defaults: ConfigDefaults) -> CanonicalKernel

Construct an empty operation under explicit compile-time defaults/bootstrap ceilings.

Source

pub fn prepare_json( &mut self, input_json: &str, ) -> KernelPreparation<KernelRecord, PlannedStep>

Strict JSON boundary for dynamic-language bindings.

Decode failures use the same closed Rejected arm as typed policy/lifecycle failures; a malformed payload never escapes as one language’s parser exception.

Source

pub fn prepare( &mut self, envelope: &WireEnvelope, ) -> KernelPreparation<KernelRecord, PlannedStep>

Plan one typed canonical envelope and stage its core-produced record.

Source

pub fn commit( &mut self, token: &PrepareToken, appended_head: &Digest, ) -> Result<CommittedTransition<PlannedStep>, KernelFault>

Complete a transition after the host durably appended the candidate record.

Source

pub fn abort( &mut self, token: &PrepareToken, ) -> Result<KernelRecord, KernelFault>

Discard a candidate that did not reach the journal and restore the semantic driver.

Source

pub fn restore( &mut self, checkpoint: Option<&KernelCheckpoint>, records: &[KernelRecord], ) -> Result<RestoreCost, KernelFault>

Rebuild this exact handle from a verified checkpoint plus records above it.

checkpoint = None means the records are the whole retained journal and the fold starts at genesis. With a checkpoint, records are strictly above through_step_seq.

Source

pub fn restore_bytes( &mut self, checkpoint_bytes: Option<&[u8]>, record_bytes: &[Vec<u8>], ) -> Result<RestoreCost, KernelFault>

Binding boundary for native checkpoint/record byte containers.

Source

pub fn checkpoint_candidate(&self) -> Result<CheckpointCandidate, KernelFault>

Produce a full-state checkpoint candidate over the current durable head.

Source

pub fn checkpoint_rebase( &self, base: &KernelCheckpoint, ) -> Result<CheckpointCandidate, KernelFault>

Produce the incremental checkpoint form over a previously captured logical base.

Source

pub fn note_checkpoint_acked( &mut self, boundary: &CheckpointBoundary, ) -> Result<TailUsage, KernelFault>

Close the retention boundary after the host durably acknowledged a checkpoint install.

Source

pub fn head(&self) -> Option<DurableHead>

Source

pub fn lifecycle(&self) -> OperationLifecycle

Source

pub fn pending_effects(&self) -> impl Iterator<Item = &KernelEffect>

Source

pub fn pending_effects_in_order(&self) -> Vec<&KernelEffect>

Self::pending_effects in publication order — the order a host consumes a multi-effect step in (see KernelTransaction::pending_effects_in_order).

Source

pub fn current_projection(&self) -> Result<CurrentProjection, ProjectionError>

The single host-facing current-action projection. The transaction owns publication ordering; this method only delegates the ordered view to the pure projection module.

Source

pub fn terminal(&self) -> Option<&KernelTerminal>

Source

pub fn attempt_id(&self, task_id: &str) -> Option<AttemptId>

Return the live kernel-issued attempt for a child task, including after checkpoint restore.

Source

pub fn turn(&self) -> u32

Current scheduler turn, restored from the canonical journal/checkpoint state.

Source

pub fn recovery_content_bytes(&self) -> Option<usize>

Recovery replay budget in bytes, when the operation has been configured.

Source

pub fn preserved_refs(&self) -> Vec<String>

Task-state references that context pressure must keep resident.

Source

pub fn count_tokens(&self, text: &str) -> Option<u32>

Count text using the configured canonical context token engine.

Source

pub fn local_subagents_spawned(&self) -> u32

Cumulative kernel-owned child spawn count for this operation.

Source

pub fn new_messages(&self) -> Vec<Message>

Messages added to the canonical operation history.

Source

pub fn poison(&self) -> Option<&KernelFault>

Trait Implementations§

Source§

impl Debug for CanonicalKernel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for CanonicalKernel

Source§

fn default() -> CanonicalKernel

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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 = !

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

fn try_from(value: U) -> Result<T, !>

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