pub struct BlobMeta {
chunk_metas: Arc<[ChunkMeta]>,
}Expand description
Describes information to assemble a Blob.
Currently stores only a list of non-empty chunk digests and offsets, but might gain bao support and other fields in the future.
(See https://snix.dev/docs/components/castore/blobstore-chunking-verified-streaming)
Fields§
§chunk_metas: Arc<[ChunkMeta]>Implementations§
Source§impl BlobMeta
impl BlobMeta
Sourcepub fn bytes_stream(
&self,
start_offset: u64,
limit_size: Option<u64>,
fetch_concurrency: usize,
chunk_store: impl ChunkStore + Clone + 'static,
) -> impl Stream<Item = Result<Cursor<Chunk>>> + 'static
pub fn bytes_stream( &self, start_offset: u64, limit_size: Option<u64>, fetch_concurrency: usize, chunk_store: impl ChunkStore + Clone + 'static, ) -> impl Stream<Item = Result<Cursor<Chunk>>> + 'static
Returns a stream of bytes of actual blob bytes.
Both a start_offset and a size limit to read can be specified.
start_offset must be inside the range of the blob.
If limit_size is set, the last element in the stream will contain a chunk with truncated data.
If limit_size would point past the end of the blob, it’s clamped to the end.
Chunks not part of that range are skipped entirely. The returned Cursor into the first chunk is advanced to the desired start_offset.
Queries the passed ChunkStore, with configurable concurrency.
Source§impl BlobMeta
impl BlobMeta
Sourcepub fn from_digests_and_sizes<T: IntoIterator<Item = (B3Digest, u64)>>(
iter: T,
) -> Self
pub fn from_digests_and_sizes<T: IntoIterator<Item = (B3Digest, u64)>>( iter: T, ) -> Self
Constructs from an iterator of digests and chunk sizes.
NOTE: The empty chunk is skipped silently, as there’s no point fetching it.
Sourcefn chunk_idx_from(&self, offset: u64) -> (usize, u64)
fn chunk_idx_from(&self, offset: u64) -> (usize, u64)
For a given offset into the blob, returns the index of the first chunk holding the requested bytes, as well as the number of bytes to skip inside the first chunk.
Sourcefn chunk_idx_until(&self, size: u64) -> (usize, u64)
fn chunk_idx_until(&self, size: u64) -> (usize, u64)
For a given length into the blob, returns the index of the last chunk holding the requested bytes,
and how many bytes of that chunk are still in range (chunk[..size])
Trait Implementations§
Source§impl TryFrom<BlobMeta> for BlobMeta
Constructs by parsing a proto::BlobMeta message.
impl TryFrom<BlobMeta> for BlobMeta
Constructs by parsing a proto::BlobMeta message.
This will reject a proto::BlobMeta message without any chunks.
This is to prevent accidentially passing a StatBlobResponse message which
historically omitted chunks in the single-chunk case.
It will also reject chunks with a size of zero
To explicitly create a BlobMeta for the empty blob, use BlobMeta::from_digests_and_sizes with an empty iterator instead.
impl Eq for BlobMeta
impl StructuralPartialEq for BlobMeta
Auto Trait Implementations§
impl Freeze for BlobMeta
impl RefUnwindSafe for BlobMeta
impl Send for BlobMeta
impl Sync for BlobMeta
impl Unpin for BlobMeta
impl UnsafeUnpin for BlobMeta
impl UnwindSafe for BlobMeta
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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].