pub struct DirectoryGraphBuilder<OV> {
order_validator: OV,
graph: DiGraph<Option<Directory>, ()>,
digest_to_node_idx: HashMap<B3Digest, NodeIndex>,
}Expand description
Constructs a DirectoryGraph with a chosen insertion order.
After deciding on the insertion order (OV generic), and calling new (wants the expected root digest in the Root-To-Leaves case), different Directory can be passed to Self::try_insert. A Self::build consumes the builder, returning a validated DirectoryGraph, or an error. The resulting DirectoryGraph can be used to drain the graph in Leaves-To-Root or Root-To-Leaves order.
Fields§
§order_validator: OVStores the order validator for the chosen insertion order.
graph: DiGraph<Option<Directory>, ()>A directed graph, using Directory as node weight. Directories are Options to allow drawing edges to not-yet-received Directories in Root-To-Leaves order. Edges point from parents to children.
digest_to_node_idx: HashMap<B3Digest, NodeIndex>A lookup table from directory digest to node index. Used to lookup where to draw edges.
Implementations§
Source§impl DirectoryGraphBuilder<LeavesToRoot>
impl DirectoryGraphBuilder<LeavesToRoot>
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new DirectoryGraphBuilder accepting directories in Leaves-To-Root order.
Source§impl DirectoryGraphBuilder<RootToLeaves>
impl DirectoryGraphBuilder<RootToLeaves>
Sourcepub fn new(root_digest: B3Digest) -> Self
pub fn new(root_digest: B3Digest) -> Self
Constructs a new DirectoryGraphBuilder accepting directories in Root-To-Leaves order. The expected root Directory needs to be passed as an argument, and is validated to match the one inserted on the first call to Self::try_insert.
Source§impl<OV> DirectoryGraphBuilder<OV>where
OV: OrderValidator,
impl<OV> DirectoryGraphBuilder<OV>where
OV: OrderValidator,
Sourcepub fn try_insert(&mut self, directory: Directory) -> Result<(), OrderingError>
pub fn try_insert(&mut self, directory: Directory) -> Result<(), OrderingError>
Accepts a directory if previously introduced, or returns an error if it’s unknown.
Sourcepub fn build(self) -> Result<DirectoryGraph, OrderingError>
pub fn build(self) -> Result<DirectoryGraph, OrderingError>
Ensures there’s no more directories missing, returns the validated DirectoryGraph.
Trait Implementations§
Source§impl Default for DirectoryGraphBuilder<LeavesToRoot>
impl Default for DirectoryGraphBuilder<LeavesToRoot>
Auto Trait Implementations§
impl<OV> Freeze for DirectoryGraphBuilder<OV>where
OV: Freeze,
impl<OV> RefUnwindSafe for DirectoryGraphBuilder<OV>where
OV: RefUnwindSafe,
impl<OV> Send for DirectoryGraphBuilder<OV>where
OV: Send,
impl<OV> Sync for DirectoryGraphBuilder<OV>where
OV: Sync,
impl<OV> Unpin for DirectoryGraphBuilder<OV>where
OV: Unpin,
impl<OV> UnsafeUnpin for DirectoryGraphBuilder<OV>where
OV: UnsafeUnpin,
impl<OV> UnwindSafe for DirectoryGraphBuilder<OV>where
OV: UnwindSafe,
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> 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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].