pub struct DependencyState { /* private fields */ }Expand description
Dependency State: Resource relationship graph
Implementations§
Source§impl DependencyState
impl DependencyState
Sourcepub async fn add_dependency(&self, from: &str, to: &str, edge: DependencyEdge)
pub async fn add_dependency(&self, from: &str, to: &str, edge: DependencyEdge)
Add a dependency between resources
For a “BlockedBy” relationship: add_dependency("op-a", "op-b", BlockedBy) means
“op-a is blocked by op-b”, so op-b must execute before op-a.
The edge direction is from→to (to comes before from in execution order).
Sourcepub async fn remove_dependency(&self, from: &str, to: &str)
pub async fn remove_dependency(&self, from: &str, to: &str)
Remove a dependency
Sourcepub async fn would_deadlock(&self, agent_id: &str, resources: &[String]) -> bool
pub async fn would_deadlock(&self, agent_id: &str, resources: &[String]) -> bool
Check if acquiring resources would create a deadlock
Sourcepub async fn get_blocking_resources(&self, resource_id: &str) -> Vec<String>
pub async fn get_blocking_resources(&self, resource_id: &str) -> Vec<String>
Get all resources that must be released before agent can acquire resource
Sourcepub async fn set_holder(&self, resource_id: &str, agent_id: Option<&str>)
pub async fn set_holder(&self, resource_id: &str, agent_id: Option<&str>)
Set the current holder of a resource
Sourcepub async fn get_current_holders(&self) -> HashMap<String, String>
pub async fn get_current_holders(&self) -> HashMap<String, String>
Get current resource holders
Sourcepub async fn get_agent_resources(&self, agent_id: &str) -> Vec<String>
pub async fn get_agent_resources(&self, agent_id: &str) -> Vec<String>
Get resources held by an agent
Sourcepub async fn get_execution_order(&self, operation_ids: &[String]) -> Vec<String>
pub async fn get_execution_order(&self, operation_ids: &[String]) -> Vec<String>
Topological sort of operations respecting dependencies
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DependencyState
impl !RefUnwindSafe for DependencyState
impl Send for DependencyState
impl Sync for DependencyState
impl Unpin for DependencyState
impl UnsafeUnpin for DependencyState
impl UnwindSafe for DependencyState
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