pub struct LeavesToRoot {
accepted_directories: HashMap<B3Digest, RangeInclusive<u64>>,
pending_directories: HashSet<B3Digest>,
last_inserted_digest: Option<B3Digest>,
poison: bool,
}Expand description
A struct holding state while consuming a sequence of Directories in Leaves-To-Root order.
Validates that newly accepted directories only reference directories which have already been accepted before, and that the sizes attached alongside the pointers match the actual sizes. Commonly used when uploading a directory closure to a store.
Fields§
§accepted_directories: HashMap<B3Digest, RangeInclusive<u64>>compat-accept-bigger-sizes only.tracks inserted directories, and their sizes observed. size is tracked as a range, as this could be a closure with legacy sizes.
pending_directories: HashSet<B3Digest>tracks seen directories which are not yet referenced by parents. (root candidates)
last_inserted_digest: Option<B3Digest>Tracks the last received digest
poison: booltracks whether Self::finalize has been called, or an error has occurred while trying to accept.
Implementations§
Source§impl LeavesToRoot
impl LeavesToRoot
pub fn new() -> Self
Sourcepub fn validate_stream<'s, S>(
directories: S,
) -> BoxStream<'s, Result<Directory, OrderingError>>
pub fn validate_stream<'s, S>( directories: S, ) -> BoxStream<'s, Result<Directory, OrderingError>>
This receives a stream of Directories, validating them to be in Leaves-To-Root order. If the order is correct, they are yielded wrapped in an Ok(). If not, we yield an error.
Trait Implementations§
Source§impl Default for LeavesToRoot
impl Default for LeavesToRoot
Source§fn default() -> LeavesToRoot
fn default() -> LeavesToRoot
Source§impl OrderValidator for LeavesToRoot
impl OrderValidator for LeavesToRoot
Source§fn try_accept(&mut self, directory: &Directory) -> Result<(), OrderingError>
fn try_accept(&mut self, directory: &Directory) -> Result<(), OrderingError>
Accepts a directory if previously introduced, or returns an error if it’s unknown.
Auto Trait Implementations§
impl Freeze for LeavesToRoot
impl RefUnwindSafe for LeavesToRoot
impl Send for LeavesToRoot
impl Sync for LeavesToRoot
impl Unpin for LeavesToRoot
impl UnsafeUnpin for LeavesToRoot
impl UnwindSafe for LeavesToRoot
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].