pub struct Blob<S> { /* private fields */ }
Expand description
A blob in the process of being written.
Implementations§
Source§impl Blob<NeedsTruncate>
impl Blob<NeedsTruncate>
Sourcepub async fn truncate(
self,
size: u64,
) -> Result<TruncateBlobSuccess, TruncateBlobError>
pub async fn truncate( self, size: u64, ) -> Result<TruncateBlobSuccess, TruncateBlobError>
Truncates the blob to the given size. On success, the blob enters the writable state.
Source§impl Blob<NeedsData>
impl Blob<NeedsData>
Sourcepub fn write(
self,
buf: &[u8],
) -> impl Future<Output = Result<BlobWriteSuccess, WriteBlobError>> + '_
pub fn write( self, buf: &[u8], ) -> impl Future<Output = Result<BlobWriteSuccess, WriteBlobError>> + '_
Writes all of the given buffer to the blob.
§Panics
Panics if a write is attempted with a buf larger than the remaining blob size.
Sourcepub async fn write_with_trace_callbacks(
self,
buf: &[u8],
after_write: &(dyn Fn(u64) + Send + Sync),
after_write_ack: &(dyn Fn() + Send + Sync),
) -> Result<BlobWriteSuccess, WriteBlobError>
pub async fn write_with_trace_callbacks( self, buf: &[u8], after_write: &(dyn Fn(u64) + Send + Sync), after_write_ack: &(dyn Fn() + Send + Sync), ) -> Result<BlobWriteSuccess, WriteBlobError>
Writes all of the given buffer to the blob.
after_write
and after_write_ack
are called before and after, respectively, waiting for
the server to acknowledge writes.
They may be called multiple times if the write of buf
is chunked.
after_write
is given the size of each write in bytes.
Useful for creating trace spans.
§Panics
Panics if a write is attempted with a buf larger than the remaining blob size.
Source§impl Blob<NeedsBlobWritten>
impl Blob<NeedsBlobWritten>
Sourcepub async fn blob_written(self) -> Result<(), BlobWrittenError>
pub async fn blob_written(self) -> Result<(), BlobWrittenError>
Tells pkg-cache that the blob has been successfully written and can now be read.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Blob<S>where
S: Freeze,
impl<S> !RefUnwindSafe for Blob<S>
impl<S> Send for Blob<S>where
S: Send,
impl<S> !Sync for Blob<S>
impl<S> Unpin for Blob<S>where
S: Unpin,
impl<S> !UnwindSafe for Blob<S>
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
Mutably borrows from an owned value. Read more