pub struct WriteEncoder<'a> { /* private fields */ }Expand description
A borrowed write producer. Before emitting, it encodes one record at a time to measure each part’s byte length and construct the header; emitting a part retains at most one record frame and one 64-KiB chunk.
Implementations§
Source§impl<'a> WriteEncoder<'a>
impl<'a> WriteEncoder<'a>
Sourcepub fn new(record: &'a WriteRecord) -> Result<Self, Error>
pub fn new(record: &'a WriteRecord) -> Result<Self, Error>
Validate the complete in-memory write and measure each part’s stream.
Sourcepub fn with_records(
record: &'a WriteRecord,
encoded: &'a [Vec<Vec<u8>>],
) -> Result<Self, Error>
pub fn with_records( record: &'a WriteRecord, encoded: &'a [Vec<Vec<u8>>], ) -> Result<Self, Error>
new for a write whose records the caller encoded already, a part’s
WritePart::encode_records each, in the parts’ order: they are
emitted as given, validated and encoded once, and the bytes are those
new produces.
Sourcepub fn header(&self) -> &WriteHeaderFrame
pub fn header(&self) -> &WriteHeaderFrame
Metadata that lets a receiver delimit each part without opening it.
Sourcepub fn header_frame(&self) -> &[u8] ⓘ
pub fn header_frame(&self) -> &[u8] ⓘ
The header’s complete kind-1 plaintext frame.
Sourcepub fn plaintext_length(&self) -> u64
pub fn plaintext_length(&self) -> u64
The queued plaintext length, for the database’s SQLite value limit.
Sourcepub fn encode_plaintext(&self, output: &mut [u8]) -> Result<(), Error>
pub fn encode_plaintext(&self, output: &mut [u8]) -> Result<(), Error>
Encode the upload-queue value into an exactly sized buffer. The database
checks Self::plaintext_length against SQLite’s limit before allocating
this buffer. A different buffer length is refused before writing bytes.