Skip to main content

CiphertextSource

Trait CiphertextSource 

Source
pub trait CiphertextSource:
    Debug
    + Send
    + Sync {
    // Required methods
    fn size(&self) -> u64;
    fn write_to(&self, writer: &mut dyn Write) -> Result<Hash32>;
}
Expand description

Where an asset’s STREAM ciphertext comes from when it is written into an artifact.

A source, not a buffer: the export streams each original straight into the artifact’s writer, so exporting holds one STREAM chunk of it rather than the whole library’s ciphertext. The library’s sources re-derive the ciphertext from the plaintext on disk (OriginalCiphertext); an in-memory Vec<u8> is a source too, for callers that already hold the bytes.

Required Methods§

Source

fn size(&self) -> u64

The ciphertext’s exact length in bytes — what the artifact’s tar header declares before a byte of the body is written.

Source

fn write_to(&self, writer: &mut dyn Write) -> Result<Hash32>

Stream the whole ciphertext into writer and return its SHA-256 content address.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CiphertextSource for Vec<u8>

Source§

fn size(&self) -> u64

Source§

fn write_to(&self, writer: &mut dyn Write) -> Result<Hash32>

Implementors§