pub struct Bundle { /* private fields */ }Expand description
An opened bundle file on disk.
Implementations§
Source§impl Bundle
impl Bundle
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, BundleError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, BundleError>
Open path and parse the header, leaving the pack at pack_offset.
§Errors
Returns BundleError when the signature or header lines are invalid.
Sourcepub fn header(&self) -> &BundleHeader
pub fn header(&self) -> &BundleHeader
Parsed header.
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Path passed to Self::open.
Sourcepub fn pack_object_count(&self) -> Result<u32, BundleError>
pub fn pack_object_count(&self) -> Result<u32, BundleError>
Object count from the embedded pack header.
§Errors
Returns BundleError::MissingPack when the pack stream is absent or truncated.
Sourcepub fn pack_byte_offset(&self) -> u64
pub fn pack_byte_offset(&self) -> u64
Byte offset in Self::path where the PACK stream begins.
Sourcepub fn verify(
&self,
repo: &Repository,
) -> Result<BundleVerifyReport, BundleError>
pub fn verify( &self, repo: &Repository, ) -> Result<BundleVerifyReport, BundleError>
Check prerequisites against repo and ref connectivity.
§Errors
Returns BundleError::ObjectFormatMismatch when hash algorithms disagree.
Sourcepub fn unbundle(
&self,
repo: &Repository,
) -> Result<Vec<UnbundledRef>, BundleError>
pub fn unbundle( &self, repo: &Repository, ) -> Result<Vec<UnbundledRef>, BundleError>
Stream the embedded pack into repo’s ODB (does not update refs).
With a files-backed primary the pack is installed under objects/pack/. With a
custom OdbBuilder::primary store the pack is
read straight from the bundle file and every object is written into that store;
no temporary file is created. A filtered (v3 filter) bundle is then not marked
as a promisor pack, since there is no pack to mark.
Pack integrity is checked while building the pack index (object hashes and the pack trailer); there is no second full read of the pack after indexing.
§Errors
Returns BundleError or ingest failures wrapped as BundleError::Io.
Sourcepub fn unbundle_with_progress(
&self,
repo: &Repository,
progress: &mut dyn ProgressSink,
cancel: &dyn Cancel,
) -> Result<UnbundleOutcome, BundleError>
pub fn unbundle_with_progress( &self, repo: &Repository, progress: &mut dyn ProgressSink, cancel: &dyn Cancel, ) -> Result<UnbundleOutcome, BundleError>
Like Self::unbundle, reporting receive and index-pack progress through progress.