pub struct BlobWriter { /* private fields */ }
Expand description
BlobWriter is a wrapper around the fuchsia.fxfs.BlobWriter fidl protocol. Clients will use this library to write blobs to disk.
Implementations§
Source§impl BlobWriter
impl BlobWriter
Sourcepub async fn create(
blob_writer_proxy: BlobWriterProxy,
size: u64,
) -> Result<Self, CreateError>
pub async fn create( blob_writer_proxy: BlobWriterProxy, size: u64, ) -> Result<Self, CreateError>
Creates a BlobWriter
. Exactly size
bytes are expected to be written into the writer.
Sourcepub async fn write(&mut self, bytes: &[u8]) -> Result<(), WriteError>
pub async fn write(&mut self, bytes: &[u8]) -> Result<(), WriteError>
Begins writing bytes
to the server.
If bytes
contains all of the remaining unwritten bytes of the blob, i.e. the sum of the
lengths of the bytes
slices from this and all prior calls to write
is equal to the size
given to create
, then the returned Future will not complete until all of the writes have
been acknowledged by the server and the blob can be opened for read.
Otherwise, the returned Future may complete before the write of bytes
has been
acknowledged by the server.
Returns an error if the length of bytes
exceeds the remaining available space in the
blob, calculated as per size
.