Struct tvix_castore::blobservice::chunked_reader::ChunkedBlob
source · struct ChunkedBlob<BS> {
blob_service: BS,
chunks: Vec<(u64, u64, B3Digest)>,
}
Expand description
Holds a list of blake3 digest for individual chunks (and their sizes). Is able to construct a Reader that seeked to a certain offset, which is useful to construct a BlobReader (that implements AsyncSeek).
- the current chunk index, and a Custor<Vec
> holding the data of that chunk.
Fields§
§blob_service: BS
§chunks: Vec<(u64, u64, B3Digest)>
Implementations§
source§impl<BS> ChunkedBlob<BS>
impl<BS> ChunkedBlob<BS>
sourcefn from_iter(
chunks_it: impl Iterator<Item = (B3Digest, u64)>,
blob_service: BS,
) -> Self
fn from_iter( chunks_it: impl Iterator<Item = (B3Digest, u64)>, blob_service: BS, ) -> Self
Constructs Self from a list of blake3 digests of chunks and their sizes, and a reference to a blob service. Initializing it with an empty list is disallowed.
sourcefn blob_length(&self) -> u64
fn blob_length(&self) -> u64
Returns the length of the blob.
sourcefn get_chunk_idx_for_position(&self, pos: u64) -> Option<usize>
fn get_chunk_idx_for_position(&self, pos: u64) -> Option<usize>
For a given position pos, return the chunk containing the data. In case this would range outside the blob, None is returned.
sourcefn reader_skipped_offset(
&self,
offset: u64,
) -> Box<dyn AsyncRead + Send + Unpin>
fn reader_skipped_offset( &self, offset: u64, ) -> Box<dyn AsyncRead + Send + Unpin>
Returns a stream of bytes of the data in that blob. It internally assembles a stream reading from each chunk (skipping over chunks containing irrelevant data). From the first relevant chunk, the irrelevant bytes are skipped too. The returned boxed thing does not implement AsyncSeek on its own, but ChunkedReader does.
Auto Trait Implementations§
impl<BS> Freeze for ChunkedBlob<BS>where
BS: Freeze,
impl<BS> RefUnwindSafe for ChunkedBlob<BS>where
BS: RefUnwindSafe,
impl<BS> Send for ChunkedBlob<BS>where
BS: Send,
impl<BS> Sync for ChunkedBlob<BS>where
BS: Sync,
impl<BS> Unpin for ChunkedBlob<BS>where
BS: Unpin,
impl<BS> UnwindSafe for ChunkedBlob<BS>where
BS: 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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request