Skip to main content

TaskTable

Struct TaskTable 

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

Unified registry of all tasks: the root loop plus one child per sub-agent. The sole source of truth for schedulability and lineage; the AgentProcess view is derived from it.

Implementations§

Source§

impl TaskTable

Source

pub fn new() -> Self

Source

pub fn insert(&mut self, tcb: Tcb)

Source

pub fn get(&self, id: &str) -> Option<&Tcb>

Source

pub fn get_mut(&mut self, id: &str) -> Option<&mut Tcb>

Source

pub fn all(&self) -> &[Tcb]

Source

pub fn children_of(&self, parent: &str) -> Vec<&Tcb>

Source

pub fn wait_index(&self) -> &WaitIndex

Source

pub fn wait_for_timer(&mut self, task_id: &str, deadline: LogicalDeadline)

Register task_id as waiting on a deadline.

Source

pub fn wake_expired_timers(&mut self, now_ms: u64) -> Vec<TaskId>

spc_003-05: wake every task whose Timer deadline is <= now_ms. Returns the woken ids.

Source

pub fn wait_for_condition(&mut self, task_id: &str, condition: &WaitCondition)

Register task_id as waiting on an arbitrary WaitCondition.

Source

pub fn wake(&mut self, key: &WaitKey) -> Vec<TaskId>

spc_003-06: wake every task waiting on exactly key. Idempotent — see super::wait_index::WaitIndex::wake.

Source

pub fn register_wait_set(&mut self, task_id: &str, wait_set: WaitSet)

spc_003 debt closure: register task_id against a full WaitSet (Any/All over multiple heterogeneous conditions) — see super::wait_index::WaitIndex::register_wait_set.

Source

pub fn clear_wait(&mut self, task_id: &str)

Clear every durable wait condition for a task without changing its lifecycle.

Source

pub fn notify(&mut self, key: &WaitKey) -> Vec<TaskId>

spc_003 debt closure: notify every task registered under key via Self::register_wait_set, returning those whose whole WaitSet is now satisfied — see super::wait_index::WaitIndex::notify.

Source

pub fn root_id(&self) -> Option<TaskId>

spc_002-04: the id of this table’s own structural root — the task with no parent — the kernel-owned fact a spawn’s parent derives from instead of a hardcoded "root" literal. None only for a table that has not yet had its root task inserted.

Source

pub fn cancel_subtree(&mut self, task_id: &str)

spc_002-06: recursively cancel task_id and every (recursive) child. Default cancellation policy — no detached-child exemption yet (future card, per spc_002 §5).

Source

pub fn cancel_children(&mut self, task_id: &str)

spc_008-04: like Self::cancel_subtree but leaves task_id itself untouched — only its (recursive) descendants are cancelled. For SupervisionPolicy.child_failure == ChildFailurePolicy::Propagate, where the terminating task’s own termination reason (set by the caller) must not be overwritten by this call. Already-terminal children are skipped so a child that already completed successfully is never retroactively relabeled as cancelled; spc_008-05: a detached direct child is skipped too, same exemption cancel_subtree’s own recursion honors — Propagate must not reach into a child that opted out of the lifecycle.

Source

pub fn return_child_budget(&mut self, child_id: &str)

spc_005-05: return_unused a child’s budget_grant (if it has one) into its parent’s child_budget_remaining, then record returned on the grant for audit. A no-op when the child never carried a grant (spawned without requested_budget, or the parent had no child_budget_remaining set — see spc_005-04) or when the parent has since lost its own remaining-budget pool. Idempotent to call twice: the second call finds consumed already reflecting the first return_unused’s inputs and returns the same (already-zeroed) delta — callers still should call this exactly once per terminal transition.

Source

pub fn send_message(&mut self, msg: MailboxMessage)

spc_006-03: deliver msg into msg.to’s mailbox. A no-op (message silently dropped) when to names no task in this table — mirrors get_mut’s own “absent id, no panic” contract used throughout this table’s other mutators.

Source

pub fn rebuild_children(&mut self)

spc_002-09: recompute every task’s children set from the authoritative parent field. insert only registers a child in its parent’s children when the parent is already present in the table (spc_002-05) — a bulk restore that inserts rows in an order other than parent-before-child silently drops those edges. This is idempotent and safe to call after any bulk load.

Source

pub fn rebuild_wait_index(&mut self)

Reinsert each task’s unsatisfied durable wait conditions after checkpoint restore.

Source

pub fn has_cycle(&self) -> bool

spc_002-08: process-tree invariant — no cycle in the parent chain of any task. Not on the spawn hot path (spawn already makes a cycle structurally unreachable, see spc_002-04); this exists to be tested and to back future debug/diagnostic tooling.

Trait Implementations§

Source§

impl Clone for TaskTable

Source§

fn clone(&self) -> TaskTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TaskTable

Source§

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

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

impl Default for TaskTable

Source§

fn default() -> TaskTable

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.