Skip to main content

DependencyGraph

Struct DependencyGraph 

Source
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

Source

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.

Source

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

Source

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.

Source

pub fn producers_of(&self, id: &ObjectId) -> Vec<(ObjectId, Provenance)>

The objects that id uses, with what kind of use each edge records.

Source

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.

Source

pub fn roots_of(&self, id: &ObjectId) -> Vec<&Provenance>

The provenance of every report binding that targets id.

Source

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.

Trait Implementations§

Source§

impl Debug for DependencyGraph

Source§

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

Formats the value using the given formatter. 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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.