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
impl CanonicalKernel
Sourcepub fn new(defaults: ConfigDefaults) -> CanonicalKernel
pub fn new(defaults: ConfigDefaults) -> CanonicalKernel
Construct an empty operation under explicit compile-time defaults/bootstrap ceilings.
Sourcepub fn prepare_json(
&mut self,
input_json: &str,
) -> KernelPreparation<KernelRecord, PlannedStep>
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.
Sourcepub fn prepare(
&mut self,
envelope: &WireEnvelope,
) -> KernelPreparation<KernelRecord, PlannedStep>
pub fn prepare( &mut self, envelope: &WireEnvelope, ) -> KernelPreparation<KernelRecord, PlannedStep>
Plan one typed canonical envelope and stage its core-produced record.
Sourcepub fn commit(
&mut self,
token: &PrepareToken,
appended_head: &Digest,
) -> Result<CommittedTransition<PlannedStep>, KernelFault>
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.
Sourcepub fn abort(
&mut self,
token: &PrepareToken,
) -> Result<KernelRecord, KernelFault>
pub fn abort( &mut self, token: &PrepareToken, ) -> Result<KernelRecord, KernelFault>
Discard a candidate that did not reach the journal and restore the semantic driver.
Sourcepub fn restore(
&mut self,
checkpoint: Option<&KernelCheckpoint>,
records: &[KernelRecord],
) -> Result<RestoreCost, KernelFault>
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.
Sourcepub fn restore_bytes(
&mut self,
checkpoint_bytes: Option<&[u8]>,
record_bytes: &[Vec<u8>],
) -> Result<RestoreCost, KernelFault>
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.
Sourcepub fn checkpoint_candidate(&self) -> Result<CheckpointCandidate, KernelFault>
pub fn checkpoint_candidate(&self) -> Result<CheckpointCandidate, KernelFault>
Produce a full-state checkpoint candidate over the current durable head.
Sourcepub fn checkpoint_rebase(
&self,
base: &KernelCheckpoint,
) -> Result<CheckpointCandidate, KernelFault>
pub fn checkpoint_rebase( &self, base: &KernelCheckpoint, ) -> Result<CheckpointCandidate, KernelFault>
Produce the incremental checkpoint form over a previously captured logical base.
Sourcepub fn note_checkpoint_acked(
&mut self,
boundary: &CheckpointBoundary,
) -> Result<TailUsage, KernelFault>
pub fn note_checkpoint_acked( &mut self, boundary: &CheckpointBoundary, ) -> Result<TailUsage, KernelFault>
Close the retention boundary after the host durably acknowledged a checkpoint install.
pub fn head(&self) -> Option<DurableHead>
pub fn lifecycle(&self) -> OperationLifecycle
pub fn pending_effects(&self) -> impl Iterator<Item = &KernelEffect>
Sourcepub fn pending_effects_in_order(&self) -> Vec<&KernelEffect>
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).
Sourcepub fn current_projection(&self) -> Result<CurrentProjection, ProjectionError>
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.
pub fn terminal(&self) -> Option<&KernelTerminal>
Sourcepub fn attempt_id(&self, task_id: &str) -> Option<AttemptId>
pub fn attempt_id(&self, task_id: &str) -> Option<AttemptId>
Return the live kernel-issued attempt for a child task, including after checkpoint restore.
Sourcepub fn turn(&self) -> u32
pub fn turn(&self) -> u32
Current scheduler turn, restored from the canonical journal/checkpoint state.
Sourcepub fn recovery_content_bytes(&self) -> Option<usize>
pub fn recovery_content_bytes(&self) -> Option<usize>
Recovery replay budget in bytes, when the operation has been configured.
Sourcepub fn preserved_refs(&self) -> Vec<String>
pub fn preserved_refs(&self) -> Vec<String>
Task-state references that context pressure must keep resident.
Sourcepub fn count_tokens(&self, text: &str) -> Option<u32>
pub fn count_tokens(&self, text: &str) -> Option<u32>
Count text using the configured canonical context token engine.
Sourcepub fn local_subagents_spawned(&self) -> u32
pub fn local_subagents_spawned(&self) -> u32
Cumulative kernel-owned child spawn count for this operation.
Sourcepub fn new_messages(&self) -> Vec<Message>
pub fn new_messages(&self) -> Vec<Message>
Messages added to the canonical operation history.