pub struct RepoDependencyGraph { /* private fields */ }Expand description
Directed dependency graph over RepoNodes.
Edges are stored as dependency → dependents adjacency lists.
Cycles are detected at insertion time via DFS.
Implementations§
Source§impl RepoDependencyGraph
impl RepoDependencyGraph
Sourcepub fn add_node(&mut self, node: RepoNode)
pub fn add_node(&mut self, node: RepoNode)
Register a RepoNode. Idempotent — re-registering an existing id
updates the node metadata.
Sourcepub fn add_dependency(
&mut self,
dependency: &str,
dependent: &str,
) -> MultiRepoResult<()>
pub fn add_dependency( &mut self, dependency: &str, dependent: &str, ) -> MultiRepoResult<()>
Add a directed dependency edge: dependent depends on dependency.
Both nodes must already be registered via [add_node].
Returns MultiRepoError::DependencyCycle if the edge would introduce
a cycle (checked via DFS before the edge is committed).
Returns MultiRepoError::RepoNotFound if either node is absent.
Sourcepub fn topological_order(&self) -> MultiRepoResult<Vec<RepoNode>>
pub fn topological_order(&self) -> MultiRepoResult<Vec<RepoNode>>
Return repos in topological order (dependencies before dependents).
Uses Kahn’s algorithm. Returns MultiRepoError::DependencyCycle
if a cycle is present (should not occur if add_dependency is used).
Sourcepub fn dependencies_of(&self, repo_id: &str) -> MultiRepoResult<Vec<&RepoNode>>
pub fn dependencies_of(&self, repo_id: &str) -> MultiRepoResult<Vec<&RepoNode>>
Return all direct dependencies of repo_id (repos it depends on).
Sourcepub fn dependents_of(&self, repo_id: &str) -> MultiRepoResult<Vec<&RepoNode>>
pub fn dependents_of(&self, repo_id: &str) -> MultiRepoResult<Vec<&RepoNode>>
Return all direct dependents of repo_id (repos that depend on it).
Sourcepub fn transitive_dependents_of(
&self,
repo_id: &str,
) -> MultiRepoResult<Vec<String>>
pub fn transitive_dependents_of( &self, repo_id: &str, ) -> MultiRepoResult<Vec<String>>
All transitive dependents of repo_id (BFS over downstream edges).
Sourcepub fn to_execution_plan(
&self,
title: &str,
) -> MultiRepoResult<RepoExecutionPlan>
pub fn to_execution_plan( &self, title: &str, ) -> MultiRepoResult<RepoExecutionPlan>
Convert to a RepoExecutionPlan by running topological sort and
grouping same-level repos as parallelizable steps.
Two steps are in the same “level” if they share exactly the same set of transitive upstream dependencies. We approximate this by tracking which Kahn wave each node belongs to.
Trait Implementations§
Source§impl Clone for RepoDependencyGraph
impl Clone for RepoDependencyGraph
Source§fn clone(&self) -> RepoDependencyGraph
fn clone(&self) -> RepoDependencyGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RepoDependencyGraph
impl Debug for RepoDependencyGraph
Source§impl Default for RepoDependencyGraph
impl Default for RepoDependencyGraph
Source§fn default() -> RepoDependencyGraph
fn default() -> RepoDependencyGraph
Auto Trait Implementations§
impl Freeze for RepoDependencyGraph
impl RefUnwindSafe for RepoDependencyGraph
impl Send for RepoDependencyGraph
impl Sync for RepoDependencyGraph
impl Unpin for RepoDependencyGraph
impl UnsafeUnpin for RepoDependencyGraph
impl UnwindSafe for RepoDependencyGraph
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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