Struct git_pack::multi_index::File
source · [−]pub struct File { /* private fields */ }
Expand description
A representation of an index file for multiple packs at the same time, typically stored in a file named ‘multi-pack-index’.
Implementations
pub fn write_from_index_paths<P>(
index_paths: Vec<PathBuf>,
out: impl Write,
progress: P,
should_interrupt: &AtomicBool,
_: Options
) -> Result<Outcome<P>, Error> where
P: Progress,
pub fn write_from_index_paths<P>(
index_paths: Vec<PathBuf>,
out: impl Write,
progress: P,
should_interrupt: &AtomicBool,
_: Options
) -> Result<Outcome<P>, Error> where
P: Progress,
Create a new multi-index file for writing to out
from the pack index files at index_paths
.
Progress is sent to progress
and interruptions checked via should_interrupt
.
Access methods
Returns the path from which the multi-index file was loaded.
Note that it might have changed in the mean time, or might have been removed as well.
Returns the amount of indices stored in this multi-index file. It’s the same as File::index_names().len(), and returned as one past the highest known index.
Returns the total amount of objects available for lookup, and returned as one past the highest known entry index
Returns the kind of hash function used for object ids available in this index.
Returns the checksum over the entire content of the file (excluding the checksum itself).
It can be used to validate it didn’t change after creation.
Return all names of index files (*.idx
) whose objects we contain.
The corresponding pack can be found by replacing the .idx
extension with .pack
.
Return the object id at the given index
, which ranges from 0 to File::num_objects().
Find the index ranging from 0 to File::num_objects() that belongs to data associated with id
, or None
if it wasn’t found.
Use this index for finding additional information via File::pack_id_and_pack_offset_at_index()
.
Given the index
ranging from 0 to File::num_objects(), return the pack index and its absolute offset into the pack.
The pack-index refers to an entry in the index_names
list, from which the pack can be derived.
pub fn verify_checksum(
&self,
progress: impl Progress,
should_interrupt: &AtomicBool
) -> Result<ObjectId, Error>
pub fn verify_checksum(
&self,
progress: impl Progress,
should_interrupt: &AtomicBool
) -> Result<ObjectId, Error>
Validate that our checksum()
matches the actual contents
of this index file, and return it if it does.
pub fn verify_integrity_fast<P>(
&self,
progress: P,
should_interrupt: &AtomicBool
) -> Result<(ObjectId, P), Error> where
P: Progress,
pub fn verify_integrity_fast<P>(
&self,
progress: P,
should_interrupt: &AtomicBool
) -> Result<(ObjectId, P), Error> where
P: Progress,
Similar to verify_integrity()
but without any deep inspection of objects.
Instead we only validate the contents of the multi-index itself.
pub fn verify_integrity<C, P, F>(
&self,
progress: P,
should_interrupt: &AtomicBool,
options: Options<F>
) -> Result<Outcome<P>, Error<Error>> where
P: Progress,
C: DecodeEntry,
F: Fn() -> C + Send + Clone,
pub fn verify_integrity<C, P, F>(
&self,
progress: P,
should_interrupt: &AtomicBool,
options: Options<F>
) -> Result<Outcome<P>, Error<Error>> where
P: Progress,
C: DecodeEntry,
F: Fn() -> C + Send + Clone,
Similar to crate::Bundle::verify_integrity()
but checks all contained indices and their packs.
Note that it’s considered a failure if an index doesn’t have a corresponding pack.
Initialization