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.
Sourcepub fn deconstruct(
self,
) -> (NeededBlobsProxy, BlobId, ClientEnd<BlobWriterMarker>)
pub fn deconstruct( self, ) -> (NeededBlobsProxy, BlobId, ClientEnd<BlobWriterMarker>)
Return the fields for manual handling of the protocol.
The returned BlobWriter client end is in the initial state of the protocol (GetVmo has not been called).
Once the blob has been written through the BlobWriter, BlobWritten should be called on the returned NeededBlobs proxy. The returned NeededBlobs proxy should not otherwise be used.
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>where
S: Sync,
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
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