Skip to main content

ArchiveWrite

Trait ArchiveWrite 

Source
pub trait ArchiveWrite: Send + Sync {
    // Required methods
    fn append(&self, bytes: &[u8]) -> Result<Extent>;
    fn name(&self) -> &'static str;
    fn durability(&self) -> &'static str;
}
Expand description

Append pushed packfile bytes to an archive, verbatim.

One trait, three durability contracts. The implementation decides when append is allowed to return; it never decides what the bytes are.

Required Methods§

Source

fn append(&self, bytes: &[u8]) -> Result<Extent>

Append these bytes and return when this implementation’s durability contract is met. Returns the byte extent written.

The bytes are stored exactly as handed over: no compression, no framing, no re-encoding. The returned (offset, len) addresses them inside the archive’s blob region and is the only thing that goes to the indexer.

Source

fn name(&self) -> &'static str

Name it on a bench row.

Source

fn durability(&self) -> &'static str

One-line statement of what a crash immediately after append returns does to the bytes. On the bench table next to the throughput, because a throughput without this is not a comparison.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§