pub struct BlobBody { /* private fields */ }Expand description
A blob as a sized stream of already-final bytes: sealed chunks for an
encrypted home, plaintext for a browsable one. Encryption-agnostic and
concrete (no dyn Stream). next_part hands the bytes to a streaming
upload in bounded windows so a large blob is never held whole in memory; the
only collect is the single-request path for blobs at or
below a provider’s multipart threshold.
Built by the cipher layer (CloudCipher::open_body), which knows scope→key and
plaintext-vs-encrypted, or by from_bytes for an
in-memory control object / the test backend.
Implementations§
Source§impl BlobBody
impl BlobBody
Sourcepub fn from_bytes(data: Vec<u8>) -> Self
pub fn from_bytes(data: Vec<u8>) -> Self
A body over already-final in-memory bytes — a sealed control object, or a
test payload. len is the byte count.
pub async fn from_file(path: &Path) -> Result<Self, String>
pub fn from_test_reader(len: u64, reader: PlaintextReader) -> Self
Sourcepub async fn next_part(
&mut self,
min: usize,
) -> Result<Option<Bytes>, CloudHomeError>
pub async fn next_part( &mut self, min: usize, ) -> Result<Option<Bytes>, CloudHomeError>
Return at least min bytes — exactly min when more remain, the remainder
at EOF — or None once fully drained. The driver calls this with the
provider’s part size, so every part except the last is exactly that size.