[][src]Struct esl01_dag::namedag::NameDag

pub struct NameDag { /* fields omitted */ }

A DAG that uses VertexName instead of ids as vertexes.

A high-level wrapper structure. Combination of IdMap and [Dag]. Maintains consistency of dag and map internally.

Methods

impl NameDag[src]

pub fn open(path: impl AsRef<Path>) -> Result<Self>[src]

pub fn add_heads_and_flush<F>(
    &mut self,
    parent_names_func: F,
    master_names: &[VertexName],
    non_master_names: &[VertexName]
) -> Result<()> where
    F: Fn(VertexName) -> Result<Vec<VertexName>>, 
[src]

Add vertexes and their ancestors to the on-disk DAG.

This is similar to calling add_heads followed by flush. But is faster.

pub fn add_heads<F>(&mut self, parents: F, heads: &[VertexName]) -> Result<()> where
    F: Fn(VertexName) -> Result<Vec<VertexName>>, 
[src]

Add vertexes and their ancestors to the in-memory DAG.

This does not write to disk. Use add_heads_and_flush to add heads and write to disk more efficiently.

The added vertexes are immediately query-able. They will get Ids assigned to the NON_MASTER group internally. The flush function can re-assign Ids to the MASTER group.

pub fn flush(&mut self, master_heads: &[VertexName]) -> Result<()>[src]

Write in-memory DAG to disk. This will also pick up changes to the DAG by other processes.

pub fn reload(&mut self) -> Result<()>[src]

Reload segments from disk. This discards in-memory content.

pub fn sort(&self, set: &NameSet) -> Result<NameSet>[src]

Sort a NameSet topologically.

pub fn parent_names(&self, name: VertexName) -> Result<Vec<VertexName>>[src]

Get ordered parent vertexes.

impl NameDag[src]

pub fn all(&self) -> Result<NameSet>[src]

Returns a SpanSet that covers all vertexes tracked by this DAG.

pub fn ancestors(&self, set: NameSet) -> Result<NameSet>[src]

Calculates all ancestors reachable from any name from the given set.

pub fn parents(&self, set: NameSet) -> Result<NameSet>[src]

Calculates parents of the given set.

Note: Parent order is not preserved. Use NameDag::parent_names to preserve order.

pub fn first_ancestor_nth(&self, name: VertexName, n: u64) -> Result<VertexName>[src]

Calculates the n-th first ancestor.

pub fn heads(&self, set: NameSet) -> Result<NameSet>[src]

Calculates heads of the given set.

pub fn children(&self, set: NameSet) -> Result<NameSet>[src]

Calculates children of the given set.

pub fn roots(&self, set: NameSet) -> Result<NameSet>[src]

Calculates roots of the given set.

pub fn gca_one(&self, set: NameSet) -> Result<Option<VertexName>>[src]

Calculates one "greatest common ancestor" of the given set.

If there are no common ancestors, return None. If there are multiple greatest common ancestors, pick one arbitrarily. Use gca_all to get all of them.

pub fn gca_all(&self, set: NameSet) -> Result<NameSet>[src]

Calculates all "greatest common ancestor"s of the given set. gca_one is faster if an arbitrary answer is ok.

pub fn common_ancestors(&self, set: NameSet) -> Result<NameSet>[src]

Calculates all common ancestors of the given set.

pub fn is_ancestor(
    &self,
    ancestor: VertexName,
    descendant: VertexName
) -> Result<bool>
[src]

Tests if ancestor is an ancestor of descendant.

pub fn heads_ancestors(&self, set: NameSet) -> Result<NameSet>[src]

Calculates "heads" of the ancestors of the given set. That is, Find Y, which is the smallest subset of set X, where ancestors(Y) is ancestors(X).

This is faster than calculating heads(ancestors(set)).

This is different from heads. In case set contains X and Y, and Y is an ancestor of X, but not the immediate ancestor, heads will include Y while this function won't.

pub fn range(&self, roots: NameSet, heads: NameSet) -> Result<NameSet>[src]

Calculates the "dag range" - vertexes reachable from both sides.

pub fn descendants(&self, set: NameSet) -> Result<NameSet>[src]

Calculates the descendants of the given set.

Trait Implementations

impl LowLevelAccess for NameDag[src]

Auto Trait Implementations

impl !RefUnwindSafe for NameDag

impl Send for NameDag

impl Sync for NameDag

impl Unpin for NameDag

impl !UnwindSafe for NameDag

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,