pub struct SplitStreamWriter<ObjectID: FsVerityHashValue> {
repo: Arc<Repository<ObjectID>>,
inline_content: Vec<u8>,
writer: Encoder<'static, Vec<u8>>,
pub sha256: Option<(Sha256, Sha256Digest)>,
}Expand description
Writer for creating split stream format files with inline content and external object references.
Fields§
§repo: Arc<Repository<ObjectID>>§inline_content: Vec<u8>§writer: Encoder<'static, Vec<u8>>§sha256: Option<(Sha256, Sha256Digest)>Optional SHA256 hasher and expected digest for validation
Implementations§
Source§impl<ObjectID: FsVerityHashValue> SplitStreamWriter<ObjectID>
impl<ObjectID: FsVerityHashValue> SplitStreamWriter<ObjectID>
Sourcepub fn new(
repo: &Arc<Repository<ObjectID>>,
refs: Option<DigestMap<ObjectID>>,
sha256: Option<Sha256Digest>,
) -> Self
pub fn new( repo: &Arc<Repository<ObjectID>>, refs: Option<DigestMap<ObjectID>>, sha256: Option<Sha256Digest>, ) -> Self
Creates a new split stream writer.
The writer is initialized with optional digest map references and an optional expected SHA256 hash for validation when the stream is finalized.
fn write_fragment( writer: &mut impl Write, size: usize, data: &[u8], ) -> Result<()>
Sourcefn flush_inline(&mut self, new_value: Vec<u8>) -> Result<()>
fn flush_inline(&mut self, new_value: Vec<u8>) -> Result<()>
flush any buffered inline data, taking new_value as the new value of the buffer
Sourcepub fn write_inline(&mut self, data: &[u8])
pub fn write_inline(&mut self, data: &[u8])
really, “add inline content to the buffer” you need to call .flush_inline() later
Sourcefn write_reference(
&mut self,
reference: &ObjectID,
padding: Vec<u8>,
) -> Result<()>
fn write_reference( &mut self, reference: &ObjectID, padding: Vec<u8>, ) -> Result<()>
write a reference to external data to the stream. If the external data had padding in the stream which is not stored in the object then pass it here as well and it will be stored inline after the reference.
Sourcepub fn write_external(&mut self, data: &[u8], padding: Vec<u8>) -> Result<()>
pub fn write_external(&mut self, data: &[u8], padding: Vec<u8>) -> Result<()>
Writes data as an external object reference with optional padding.
The data is stored in the repository and a reference is written to the stream. Any padding bytes are stored inline after the reference.
Sourcepub async fn write_external_async(
&mut self,
data: Vec<u8>,
padding: Vec<u8>,
) -> Result<()>
pub async fn write_external_async( &mut self, data: Vec<u8>, padding: Vec<u8>, ) -> Result<()>
Asynchronously writes data as an external object reference with optional padding.
The data is stored in the repository asynchronously and a reference is written to the stream. Any padding bytes are stored inline after the reference.