pub struct PackIndex {
pub version: u32,
pub fan_out: [u32; 256],
pub object_names: Vec<[u8; 20]>,
pub crc32_checksums: Vec<u32>,
pub offsets: Vec<u32>,
pub large_offsets: Option<Vec<u64>>,
pub pack_checksum: [u8; 20],
pub index_checksum: [u8; 20],
pub raw_data: Vec<u8>,
}
Expand description
Represents a Git pack index file (.idx)
Pack index files provide efficient lookup into pack files by mapping object SHA-1 hashes to their byte offsets within the corresponding pack file.
Fields§
§version: u32
Index file format version (should be 2)
fan_out: [u32; 256]
Fan-out table: 256 entries indicating object count for each first byte
object_names: Vec<[u8; 20]>
Sorted array of 20-byte SHA-1 object names
crc32_checksums: Vec<u32>
CRC32 checksums for packed object data (for integrity verification)
offsets: Vec<u32>
4-byte offsets into the pack file for each object
large_offsets: Option<Vec<u64>>
Optional 8-byte offsets for large pack files (when 4-byte offset has MSB set)
pack_checksum: [u8; 20]
SHA-1 checksum of the corresponding pack file
index_checksum: [u8; 20]
SHA-1 checksum of all the index data above
raw_data: Vec<u8>
Raw data for debugging/display purposes
Implementations§
Source§impl PackIndex
impl PackIndex
Sourcepub fn object_count(&self) -> usize
pub fn object_count(&self) -> usize
Get the total number of objects in this index
Sourcepub fn lookup_object(&self, sha1: &[u8; 20]) -> Option<u64>
pub fn lookup_object(&self, sha1: &[u8; 20]) -> Option<u64>
Look up an object by its SHA-1 hash Returns the offset in the pack file if found
Sourcepub fn get_object_offset(&self, index: usize) -> u64
pub fn get_object_offset(&self, index: usize) -> u64
Get the pack file offset for an object at the given index
Sourcepub fn get_object_crc32(&self, index: usize) -> Option<u32>
pub fn get_object_crc32(&self, index: usize) -> Option<u32>
Get the CRC32 checksum for an object at the given index
Sourcepub fn verify_checksum(&self) -> Result<(), PackError>
pub fn verify_checksum(&self) -> Result<(), PackError>
Verify the integrity of the index file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PackIndex
impl RefUnwindSafe for PackIndex
impl Send for PackIndex
impl Sync for PackIndex
impl Unpin for PackIndex
impl UnwindSafe for PackIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
. Read more