pub struct BoundedWorkGraph { /* private fields */ }Expand description
Bounded, acyclic work graph with enforced fan-out and budget constraints.
Implementations§
Source§impl BoundedWorkGraph
impl BoundedWorkGraph
Sourcepub fn validate_invariants(&self) -> Result<(), WorkGraphError>
pub fn validate_invariants(&self) -> Result<(), WorkGraphError>
Validate every persisted structural and accounting invariant before use.
pub fn root_agent_for(&self, node_id: &str) -> Result<&str, WorkGraphError>
Sourcepub fn stop(
&mut self,
node_id: &str,
reason: StopReason,
) -> Result<Vec<String>, WorkGraphError>
pub fn stop( &mut self, node_id: &str, reason: StopReason, ) -> Result<Vec<String>, WorkGraphError>
Stop a node and all its descendants (cascade).
Sourcepub fn stop_unlaunched(
&mut self,
node_id: &str,
reason: StopReason,
) -> Result<Vec<String>, WorkGraphError>
pub fn stop_unlaunched( &mut self, node_id: &str, reason: StopReason, ) -> Result<Vec<String>, WorkGraphError>
Stop a node whose start was refused before the host received a launch: no child process exists, so its paths are free at once.
Sourcepub fn consume_budget(
&mut self,
node_id: &str,
tokens: u64,
cost_micros: u64,
) -> Result<bool, WorkGraphError>
pub fn consume_budget( &mut self, node_id: &str, tokens: u64, cost_micros: u64, ) -> Result<bool, WorkGraphError>
Record token consumption on a node.
Sourcepub fn consume_tokens(
&mut self,
node_id: &str,
tokens: u64,
) -> Result<(), WorkGraphError>
pub fn consume_tokens( &mut self, node_id: &str, tokens: u64, ) -> Result<(), WorkGraphError>
Records token consumption for a node and updates its chain budget.
Sourcepub fn chain_budget_for(&self, node_id: &str) -> Option<&ChainBudget>
pub fn chain_budget_for(&self, node_id: &str) -> Option<&ChainBudget>
Returns the chain budget for a given node’s chain.
Sourcepub fn over_budget_chains(&self, threshold_pct: f64) -> Vec<&ChainBudget>
pub fn over_budget_chains(&self, threshold_pct: f64) -> Vec<&ChainBudget>
Returns all chains at or above their utilization threshold.
Sourcepub fn enforce_stop_conditions(&mut self) -> Vec<(String, StopReason)>
pub fn enforce_stop_conditions(&mut self) -> Vec<(String, StopReason)>
Check all nodes for stop conditions and cascade.
pub fn get_node(&self, node_id: &str) -> Option<&WorkNode>
Sourcepub fn begin_delivery_attempt(
&mut self,
node_id: &str,
fence: &str,
attempt: u8,
) -> Result<(), WorkGraphError>
pub fn begin_delivery_attempt( &mut self, node_id: &str, fence: &str, attempt: u8, ) -> Result<(), WorkGraphError>
Advance only the current running incarnation; retries revoke the prior attempt’s delivery authority without changing the node claim fence.
pub fn contains_agent(&self, agent_id: &str) -> bool
pub fn children_of(&self, node_id: &str) -> &[String]
Sourcepub fn has_live_path_conflict(
&self,
requested: &[String],
now_epoch_ms: u64,
except_node_id: Option<&str>,
) -> bool
pub fn has_live_path_conflict( &self, requested: &[String], now_epoch_ms: u64, except_node_id: Option<&str>, ) -> bool
A started incarnation holds its paths while it runs and, once stopped, until its window ends: LeanCTX cannot observe the host’s child exit, so a stopped child keeps write exclusivity for the time it was granted.
pub fn active_count(&self) -> usize
pub fn total_count(&self) -> usize
Source§impl BoundedWorkGraph
impl BoundedWorkGraph
pub fn new(max_fan_out: usize, max_depth: u16) -> BoundedWorkGraph
pub fn with_local_concurrency( self, max_local_concurrency: usize, ) -> BoundedWorkGraph
pub fn with_graph_id( self, graph_id: &str, ) -> Result<BoundedWorkGraph, WorkGraphError>
pub fn bind_graph_id(&mut self, graph_id: &str) -> Result<(), WorkGraphError>
pub fn graph_id(&self) -> &str
Sourcepub fn observation(&self) -> Value
pub fn observation(&self) -> Value
Compact, deterministic observation for controllers. Payloads, capability references and execution fences remain in the authorized detail API.
Sourcepub fn observe_if_changed(&self, if_revision: Option<&str>) -> Value
pub fn observe_if_changed(&self, if_revision: Option<&str>) -> Value
Return only a stable revision when the caller already has this state. Revision is a cache validator, never an authorization or execution token.
Sourcepub fn add_root(
&mut self,
node_id: String,
agent_id: String,
capsule_ref: String,
budget: WorkNodeBudget,
) -> Result<&WorkNode, WorkGraphError>
pub fn add_root( &mut self, node_id: String, agent_id: String, capsule_ref: String, budget: WorkNodeBudget, ) -> Result<&WorkNode, WorkGraphError>
Add a root node (no parent).
Sourcepub fn delegate(
&mut self,
parent_node_id: &str,
child_node_id: String,
child_agent_id: String,
capsule_ref: String,
child_budget: WorkNodeBudget,
) -> Result<&WorkNode, WorkGraphError>
pub fn delegate( &mut self, parent_node_id: &str, child_node_id: String, child_agent_id: String, capsule_ref: String, child_budget: WorkNodeBudget, ) -> Result<&WorkNode, WorkGraphError>
Delegate work to a child node. Validates budget inheritance and fan-out.
Sourcepub fn queue_child(
&mut self,
parent_node_id: &str,
child_node_id: String,
child_agent_id: String,
capsule_ref: String,
child_budget: WorkNodeBudget,
) -> Result<&WorkNode, WorkGraphError>
pub fn queue_child( &mut self, parent_node_id: &str, child_node_id: String, child_agent_id: String, capsule_ref: String, child_budget: WorkNodeBudget, ) -> Result<&WorkNode, WorkGraphError>
Queue child work without consuming a local execution slot.
Sourcepub fn claim_and_activate(
&mut self,
node_id: &str,
) -> Result<&WorkNode, WorkGraphError>
pub fn claim_and_activate( &mut self, node_id: &str, ) -> Result<&WorkNode, WorkGraphError>
Atomically claim pending local work and activate it when a slot is free.
pub fn claim_and_activate_until( &mut self, node_id: &str, lease_expires_epoch_ms: Option<u64>, ) -> Result<&WorkNode, WorkGraphError>
Sourcepub fn claim_or_resume_active_until(
&mut self,
node_id: &str,
lease_expires_epoch_ms: u64,
) -> Result<&WorkNode, WorkGraphError>
pub fn claim_or_resume_active_until( &mut self, node_id: &str, lease_expires_epoch_ms: u64, ) -> Result<&WorkNode, WorkGraphError>
Claim pending work or renew the same owner’s already-issued execution fence.
pub fn recover_expired_execution( &mut self, node_id: &str, now_epoch_ms: u64, ) -> Result<Vec<String>, WorkGraphError>
Sourcepub fn set_path_claims(
&mut self,
node_id: &str,
path_claims: Vec<String>,
) -> Result<(), WorkGraphError>
pub fn set_path_claims( &mut self, node_id: &str, path_claims: Vec<String>, ) -> Result<(), WorkGraphError>
Bind deterministic project-relative path leases before a queued node is claimed.
pub fn configure_root_context( &mut self, node_id: &str, task_ref: &str, policy_ref: &str, expected_outcome_ref: &str, ) -> Result<(), WorkGraphError>
pub fn configure_child_context( &mut self, node_id: &str, task_ref: &str, expected_outcome_ref: &str, ) -> Result<(), WorkGraphError>
Sourcepub fn allocate_child_budget(
&mut self,
parent_id: &str,
child_id: &str,
fraction: f64,
) -> Result<WorkNodeBudget, WorkGraphError>
pub fn allocate_child_budget( &mut self, parent_id: &str, child_id: &str, fraction: f64, ) -> Result<WorkNodeBudget, WorkGraphError>
Allocates budget for a child node using cascade rules.
The returned budget is reserved for child_id until it is passed to
Self::delegate, so chain allocation is not counted twice.
Sourcepub fn complete(
&mut self,
node_id: &str,
outcome_ref: String,
) -> Result<(), WorkGraphError>
pub fn complete( &mut self, node_id: &str, outcome_ref: String, ) -> Result<(), WorkGraphError>
Mark a node as completed with an outcome reference.
Sourcepub fn record_child_receipt(
&mut self,
receipt: ChildExecutionReceipt,
) -> Result<(), WorkGraphError>
pub fn record_child_receipt( &mut self, receipt: ChildExecutionReceipt, ) -> Result<(), WorkGraphError>
Validate and record a terminal receipt for active child execution.
Sourcepub fn evaluate_child_outcome(
&self,
node_id: &str,
) -> Result<ChildOutcome, WorkGraphError>
pub fn evaluate_child_outcome( &self, node_id: &str, ) -> Result<ChildOutcome, WorkGraphError>
Return the validated terminal outcome for a child node.
Sourcepub fn mark_accepted_path(
&mut self,
node_ids: &[String],
) -> Result<(), WorkGraphError>
pub fn mark_accepted_path( &mut self, node_ids: &[String], ) -> Result<(), WorkGraphError>
Mark accepted result nodes. Every marked node must have an accepted terminal receipt; partial results cannot establish acceptance. Ancestors are included deterministically.
pub fn is_on_accepted_path(&self, node_id: &str) -> bool
Sourcepub fn fuse_accepted_results(&self) -> Result<FusedResults, WorkGraphError>
pub fn fuse_accepted_results(&self) -> Result<FusedResults, WorkGraphError>
Fuse accepted claims in stable key/value/node order. Conflicting keys are excluded from accepted output and represented explicitly.
pub fn attribution(&self) -> Result<WorkAttribution, WorkGraphError>
pub fn team_value_report(&self) -> Result<TeamValueReport, WorkGraphError>
Trait Implementations§
Source§impl Clone for BoundedWorkGraph
impl Clone for BoundedWorkGraph
Source§fn clone(&self) -> BoundedWorkGraph
fn clone(&self) -> BoundedWorkGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BoundedWorkGraph
impl Debug for BoundedWorkGraph
Source§impl Default for BoundedWorkGraph
impl Default for BoundedWorkGraph
Source§fn default() -> BoundedWorkGraph
fn default() -> BoundedWorkGraph
Source§impl<'de> Deserialize<'de> for BoundedWorkGraph
impl<'de> Deserialize<'de> for BoundedWorkGraph
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BoundedWorkGraph, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BoundedWorkGraph, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for BoundedWorkGraph
impl Serialize for BoundedWorkGraph
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Forget for BoundedWorkGraph
impl Freeze for BoundedWorkGraph
impl Move for BoundedWorkGraph
impl RefUnwindSafe for BoundedWorkGraph
impl Send for BoundedWorkGraph
impl Sync for BoundedWorkGraph
impl Unpin for BoundedWorkGraph
impl UnsafeUnpin for BoundedWorkGraph
impl UnwindSafe for BoundedWorkGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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