pub struct TaskGraph {
pub id: Uuid,
pub project_id: Uuid,
pub name: String,
pub description: Option<String>,
pub state: GraphState,
pub tasks: HashMap<Uuid, GraphTask>,
pub dependencies: HashMap<Uuid, HashSet<Uuid>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
A TaskGraph - static DAG of planned intent.
Fields§
§id: UuidUnique graph ID.
project_id: UuidAssociated project ID.
name: StringGraph name.
description: Option<String>Graph description.
state: GraphStateCurrent state.
tasks: HashMap<Uuid, GraphTask>Task nodes.
dependencies: HashMap<Uuid, HashSet<Uuid>>Dependencies (task_id -> set of dependency task_ids).
created_at: DateTime<Utc>Creation timestamp.
updated_at: DateTime<Utc>Last update timestamp.
Implementations§
Source§impl TaskGraph
impl TaskGraph
Sourcepub fn is_modifiable(&self) -> bool
pub fn is_modifiable(&self) -> bool
Checks if the graph is modifiable.
Sourcepub fn add_dependency(&mut self, from: Uuid, to: Uuid) -> Result<(), GraphError>
pub fn add_dependency(&mut self, from: Uuid, to: Uuid) -> Result<(), GraphError>
Adds a dependency between tasks.
§Errors
Returns an error if the graph is locked, tasks don’t exist, or would create a cycle.
Sourcepub fn validate(&mut self) -> Result<(), GraphError>
pub fn validate(&mut self) -> Result<(), GraphError>
Validates the graph and transitions to Validated state.
§Errors
Returns an error if validation fails.
Sourcepub fn lock(&mut self) -> Result<(), GraphError>
pub fn lock(&mut self) -> Result<(), GraphError>
Sourcepub fn topological_order(&self) -> Vec<Uuid>
pub fn topological_order(&self) -> Vec<Uuid>
Returns tasks in topological order (dependencies first).
Sourcepub fn root_tasks(&self) -> Vec<Uuid>
pub fn root_tasks(&self) -> Vec<Uuid>
Gets tasks that have no dependencies (entry points).
Sourcepub fn dependents(&self, task_id: Uuid) -> Vec<Uuid>
pub fn dependents(&self, task_id: Uuid) -> Vec<Uuid>
Gets tasks that depend on a given task.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskGraph
impl<'de> Deserialize<'de> for TaskGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TaskGraph
impl RefUnwindSafe for TaskGraph
impl Send for TaskGraph
impl Sync for TaskGraph
impl Unpin for TaskGraph
impl UnwindSafe for TaskGraph
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.