pub struct Sealed<B: Blob> { /* private fields */ }Expand description
An immutable, page-cache-backed read handle for a Blob. The read-only counterpart to
super::Writer.
Implementations§
Source§impl<B: Blob> Sealed<B>
impl<B: Blob> Sealed<B>
Sourcepub async fn sync(&self) -> Result<(), Error>
pub async fn sync(&self) -> Result<(), Error>
Make pending bytes on the underlying blob durable. Idempotent.
Sourcepub async fn read_at(&self, offset: u64, len: usize) -> Result<IoBufs, Error>
pub async fn read_at(&self, offset: u64, len: usize) -> Result<IoBufs, Error>
Read exactly len immutable bytes starting at offset.
Sourcepub fn try_read_sync_into(&self, buf: &mut [u8], offset: u64) -> bool
pub fn try_read_sync_into(&self, buf: &mut [u8], offset: u64) -> bool
Read into buf if it can be done synchronously without I/O. Returns true only if all
buf.len() bytes were satisfied from the page cache and/or the in-memory tail. When false
is returned, the contents of buf are unspecified.
Sourcepub async fn read_into(&self, buf: &mut [u8], offset: u64) -> Result<(), Error>
pub async fn read_into(&self, buf: &mut [u8], offset: u64) -> Result<(), Error>
Reads bytes starting at offset into buf.
Sourcepub async fn read_up_to(
&self,
offset: u64,
len: usize,
bufs: impl Into<IoBufMut> + Send,
) -> Result<(IoBufMut, usize), Error>
pub async fn read_up_to( &self, offset: u64, len: usize, bufs: impl Into<IoBufMut> + Send, ) -> Result<(IoBufMut, usize), Error>
Reads up to len bytes starting at offset, but only as many as are available.
Returns the buffer (truncated to actual bytes read) and the number of bytes read. Returns an error if no bytes are available at the given offset.
Sourcepub async fn read_many_into(
&self,
buf: &mut [u8],
offsets: &[u64],
item_size: NonZeroUsize,
) -> Result<usize, Error>
pub async fn read_many_into( &self, buf: &mut [u8], offsets: &[u64], item_size: NonZeroUsize, ) -> Result<usize, Error>
Read multiple fixed-size items at sorted byte offsets into a contiguous caller buffer.
buf must be exactly offsets.len() * item_size bytes. All offsets must be sorted,
non-overlapping, and within bounds.
Returns the number of items fully served without a blob read (from the in-memory tail and the page cache). The remaining items required at least one blob read.
Sourcepub fn try_read_many_sync_into(
&self,
buf: &mut [u8],
offsets: &[u64],
item_size: NonZeroUsize,
) -> Vec<usize>
pub fn try_read_many_sync_into( &self, buf: &mut [u8], offsets: &[u64], item_size: NonZeroUsize, ) -> Vec<usize>
Like Self::read_many_into, but synchronous and cache-only. Returns the indices of
items that require a blob read. Their slots in buf hold unspecified bytes.
Sourcepub fn try_read_ranges_sync_into(
&self,
buf: &mut [u8],
ranges: &[(u64, usize)],
) -> Vec<usize>
pub fn try_read_ranges_sync_into( &self, buf: &mut [u8], ranges: &[(u64, usize)], ) -> Vec<usize>
Like Self::try_read_many_sync_into, but for variable-length (offset, len) ranges:
buf holds one slot per range, back to back.
Sourcepub fn replay(&self, buffer_size: NonZeroUsize) -> Result<Replay<B>, Error>
pub fn replay(&self, buffer_size: NonZeroUsize) -> Result<Replay<B>, Error>
Returns a Replay for sequentially reading all logical bytes of the sealed view.
Sealed values have no write buffer to flush, so unlike super::Writer::replay this method
is not async.
Trait Implementations§
Auto Trait Implementations§
impl<B> !RefUnwindSafe for Sealed<B>
impl<B> !UnwindSafe for Sealed<B>
impl<B> Freeze for Sealed<B>
impl<B> Send for Sealed<B>
impl<B> Sync for Sealed<B>
impl<B> Unpin for Sealed<B>
impl<B> UnsafeUnpin for Sealed<B>
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<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>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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