Skip to main content

archive_out

Function archive_out 

Source
pub fn archive_out(
    repo_dir: &Path,
    out: &Path,
    from_generation: u64,
) -> Result<ArchiveOutReceipt>
Expand description

Write one repository’s bytes above from_generation into out.

repo_dir is the repository directory (the one holding OBJECT_FORMAT and the store directory). from_generation is an objects.pack byte offset: 0 for a full archive, a previous receipt’s to_generation for an incremental one.

The pack is read while the server may still be appending to it. That is safe and it is the whole point of an append-only file: the cut is taken at a length read once, up front, and every byte below that length is already durable (ArchiveWrite::append fsyncs the blob, then the journal row, then fsyncs that). Bytes appended after the cut simply belong to the next archive. There is no torn state to quiesce for.

This is archive_out_to plus a file: the create, the flush and the sync_all that a file destination owes and a socket does not.