pub struct DependencyGraph { /* private fields */ }Expand description
The dependency graph of one semantic model and the reports sharing it.
Build it once with DependencyGraph::build, then query: who uses an
object (consumers_of), what an object
uses (producers_of), and what nothing
reaches (unused_objects).
Implementations§
Source§impl DependencyGraph
impl DependencyGraph
Sourcepub fn build(db: &TabularDatabase, reports: &[&ReportModel]) -> Self
pub fn build(db: &TabularDatabase, reports: &[&ReportModel]) -> Self
Builds the graph for one model and every report that shares it.
Never fails: resolution misses are data, never errors. Passing no reports leaves every model object unused unless a role keeps it alive.
Sourcepub fn object_ids(&self) -> impl Iterator<Item = &ObjectId>
pub fn object_ids(&self) -> impl Iterator<Item = &ObjectId>
Every object in the graph, in build order (model order, then relationships, roles, shared expressions, functions, report measures).
Sourcepub fn consumers_of(&self, id: &ObjectId) -> Vec<(ObjectId, Provenance)>
pub fn consumers_of(&self, id: &ObjectId) -> Vec<(ObjectId, Provenance)>
The objects that use id, with what kind of use each edge records —
the query the ripbi deps view is built on. Report bindings are not
object-to-object edges; they are answered by
roots_of.
Sourcepub fn producers_of(&self, id: &ObjectId) -> Vec<(ObjectId, Provenance)>
pub fn producers_of(&self, id: &ObjectId) -> Vec<(ObjectId, Provenance)>
The objects that id uses, with what kind of use each edge records.
Sourcepub fn roots(&self) -> &[(ObjectId, Provenance)]
pub fn roots(&self) -> &[(ObjectId, Provenance)]
Every reachability root: the report bindings, with their targets and provenance, in report order. Deterministic for a given set of reports.
Sourcepub fn roots_of(&self, id: &ObjectId) -> Vec<&Provenance>
pub fn roots_of(&self, id: &ObjectId) -> Vec<&Provenance>
The provenance of every report binding that targets id.
Sourcepub fn unused_objects(&self) -> Vec<UnusedObject>
pub fn unused_objects(&self) -> Vec<UnusedObject>
Every object reachability never reached, sorted by object identity:
the scan findings. Each finding names who still references it —
empty for a true orphan, and every referencing object is either itself
unused or a key column kept alive only as a relationship endpoint.