Skip to main content

BoundedWorkGraph

Struct BoundedWorkGraph 

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

Bounded, acyclic work graph with enforced fan-out and budget constraints.

Implementations§

Source§

impl BoundedWorkGraph

Source

pub fn validate_invariants(&self) -> Result<(), WorkGraphError>

Validate every persisted structural and accounting invariant before use.

Source

pub fn root_agent_for(&self, node_id: &str) -> Result<&str, WorkGraphError>

Source

pub fn stop( &mut self, node_id: &str, reason: StopReason, ) -> Result<Vec<String>, WorkGraphError>

Stop a node and all its descendants (cascade).

Source

pub fn consume_budget( &mut self, node_id: &str, tokens: u64, cost_micros: u64, ) -> Result<bool, WorkGraphError>

Record token consumption on a node.

Source

pub fn consume_tokens( &mut self, node_id: &str, tokens: u64, ) -> Result<(), WorkGraphError>

Records token consumption for a node and updates its chain budget.

Source

pub fn chain_budget_for(&self, node_id: &str) -> Option<&ChainBudget>

Returns the chain budget for a given node’s chain.

Source

pub fn over_budget_chains(&self, threshold_pct: f64) -> Vec<&ChainBudget>

Returns all chains at or above their utilization threshold.

Source

pub fn enforce_stop_conditions(&mut self) -> Vec<(String, StopReason)>

Check all nodes for stop conditions and cascade.

Source

pub fn get_node(&self, node_id: &str) -> Option<&WorkNode>

Source

pub fn contains_agent(&self, agent_id: &str) -> bool

Source

pub fn children_of(&self, node_id: &str) -> &[String]

Source

pub fn active_count(&self) -> usize

Source

pub fn total_count(&self) -> usize

Source§

impl BoundedWorkGraph

Source

pub fn new(max_fan_out: usize, max_depth: u16) -> Self

Source

pub fn with_local_concurrency(self, max_local_concurrency: usize) -> Self

Source

pub fn with_graph_id(self, graph_id: &str) -> Result<Self, WorkGraphError>

Source

pub fn bind_graph_id(&mut self, graph_id: &str) -> Result<(), WorkGraphError>

Source

pub fn graph_id(&self) -> &str

Source

pub fn observation(&self) -> Value

Compact, deterministic observation for controllers. Payloads, capability references and execution fences remain in the authorized detail API.

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

pub fn claim_and_activate_until( &mut self, node_id: &str, lease_expires_epoch_ms: Option<u64>, ) -> Result<&WorkNode, WorkGraphError>

Source

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.

Source

pub fn recover_expired_execution( &mut self, node_id: &str, now_epoch_ms: u64, ) -> Result<Vec<String>, WorkGraphError>

Source

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.

Source

pub fn configure_root_context( &mut self, node_id: &str, task_ref: &str, policy_ref: &str, expected_outcome_ref: &str, ) -> Result<(), WorkGraphError>

Source

pub fn configure_child_context( &mut self, node_id: &str, task_ref: &str, expected_outcome_ref: &str, ) -> Result<(), WorkGraphError>

Source

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.

Source

pub fn complete( &mut self, node_id: &str, outcome_ref: String, ) -> Result<(), WorkGraphError>

Mark a node as completed with an outcome reference.

Source

pub fn record_child_receipt( &mut self, receipt: ChildExecutionReceipt, ) -> Result<(), WorkGraphError>

Validate and record a terminal receipt for active child execution.

Source

pub fn record_failed_execution_spend( &mut self, spend: MeasuredExecutionSpend, ) -> Result<(), WorkGraphError>

Persist verified provider spend that exceeded the node authorization.

The node remains unsettled so its full reservation can never become reusable headroom. Actual spend is retained separately for waste attribution, including the amount above the allocation.

Source

pub fn evaluate_child_outcome( &self, node_id: &str, ) -> Result<ChildOutcome, WorkGraphError>

Return the validated terminal outcome for a child node.

Source

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.

Source

pub fn is_on_accepted_path(&self, node_id: &str) -> bool

Source

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.

Source

pub fn attribution(&self) -> Result<WorkAttribution, WorkGraphError>

Source

pub fn team_value_report(&self) -> Result<TeamValueReport, WorkGraphError>

Trait Implementations§

Source§

impl Clone for BoundedWorkGraph

Source§

fn clone(&self) -> Self

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 BoundedWorkGraph

Source§

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

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

impl Default for BoundedWorkGraph

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for BoundedWorkGraph

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for BoundedWorkGraph

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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: 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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