pub struct Bundle {
pub pack: File,
pub index: File,
}
Expand description
A bundle of pack data and the corresponding pack index
Fields§
§pack: File
The pack file corresponding to index
index: File
The index file corresponding to pack
Implementations§
source§impl Bundle
impl Bundle
Initialization
sourcepub fn at(path: impl AsRef<Path>, object_hash: Kind) -> Result<Self, Error>
pub fn at(path: impl AsRef<Path>, object_hash: Kind) -> Result<Self, Error>
Create a Bundle
from path
, which is either a pack file (*.pack) or an index file (*.idx).
The corresponding complementary file is expected to be present.
The object_hash
is a way to read (and write) the same file format with different hashes, as the hash kind
isn’t stored within the file format itself.
source§impl Bundle
impl Bundle
sourcepub fn find<'a>(
&self,
id: &oid,
out: &'a mut Vec<u8>,
inflate: &mut Inflate,
cache: &mut dyn DecodeEntry,
) -> Result<Option<(Data<'a>, Location)>, Error>
pub fn find<'a>( &self, id: &oid, out: &'a mut Vec<u8>, inflate: &mut Inflate, cache: &mut dyn DecodeEntry, ) -> Result<Option<(Data<'a>, Location)>, Error>
Find an object with the given ObjectId
and place its data into out
.
inflate
is used to decompress objects, and will be reset before first use, but not after the last use.
cache
is used to accelerate the lookup.
Note that ref deltas are automatically resolved within this pack only, which makes this implementation unusable for thin packs, which by now are expected to be resolved already.
sourcepub fn get_object_by_index<'a>(
&self,
idx: u32,
out: &'a mut Vec<u8>,
inflate: &mut Inflate,
cache: &mut dyn DecodeEntry,
) -> Result<(Data<'a>, Location), Error>
pub fn get_object_by_index<'a>( &self, idx: u32, out: &'a mut Vec<u8>, inflate: &mut Inflate, cache: &mut dyn DecodeEntry, ) -> Result<(Data<'a>, Location), Error>
Special-use function to get an object given an index previously returned from
index::File::.
inflate
is used to decompress objects, and will be reset before first use, but not after the last use.
§Panics
If index
is out of bounds.
source§impl Bundle
impl Bundle
sourcepub fn verify_integrity<C, F>(
&self,
progress: &mut dyn DynNestedProgress,
should_interrupt: &AtomicBool,
options: Options<F>,
) -> Result<Outcome, Error<Error>>
pub fn verify_integrity<C, F>( &self, progress: &mut dyn DynNestedProgress, should_interrupt: &AtomicBool, options: Options<F>, ) -> Result<Outcome, Error<Error>>
Similar to crate::index::File::verify_integrity()
but more convenient to call as the presence of the
pack file is a given.