pub struct PackIndex {
pub version: u32,
pub fanout: [u32; 256],
pub entries: Vec<PackIndexEntry>,
pub pack_checksum: ObjectId,
pub index_checksum: ObjectId,
}Fields§
§version: u32§fanout: [u32; 256]§entries: Vec<PackIndexEntry>§pack_checksum: ObjectId§index_checksum: ObjectIdImplementations§
Source§impl PackIndex
impl PackIndex
pub fn write_v2_for_pack_sha1(pack_bytes: &[u8]) -> Result<PackIndexBuild>
pub fn write_v2_for_pack( pack_bytes: &[u8], format: ObjectFormat, ) -> Result<PackIndexBuild>
Sourcepub fn write_v2_for_pack_reader<R>(
reader: &mut R,
format: ObjectFormat,
) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_reader<R>( reader: &mut R, format: ObjectFormat, ) -> Result<PackStreamIndexBuild>
Validate and index a pack from the reader’s current position to EOF.
This produces the same v2 .idx bytes and object metadata as
PackIndex::write_v2_for_pack without requiring the caller to provide
the pack as one contiguous byte slice. The reader is left positioned at
EOF on success.
Sourcepub fn write_v2_for_pack_reader_to_trailer<R>(
reader: &mut R,
format: ObjectFormat,
) -> Result<PackStreamIndexBuild>where
R: Read,
pub fn write_v2_for_pack_reader_to_trailer<R>(
reader: &mut R,
format: ObjectFormat,
) -> Result<PackStreamIndexBuild>where
R: Read,
Validate and index a pack from the reader’s current position, stopping after the pack trailer checksum.
This is for transports where the pack length is not known in advance but the stream is expected to contain exactly one pack. It avoids forcing the caller to first materialize the pack only to learn its length.
pub fn write_v2_for_pack_reader_with_len<R>(
reader: &mut R,
format: ObjectFormat,
pack_len: u64,
) -> Result<PackStreamIndexBuild>where
R: Read,
Sourcepub fn write_v2_for_pack_path(
path: impl AsRef<Path>,
format: ObjectFormat,
) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_path( path: impl AsRef<Path>, format: ObjectFormat, ) -> Result<PackStreamIndexBuild>
Validate and index a pack from a filesystem path without loading the entire pack file into memory.
pub fn parse_v2_sha1(bytes: &[u8]) -> Result<Self>
pub fn parse(bytes: &[u8], format: ObjectFormat) -> Result<Self>
pub fn parse_without_checksum( bytes: &[u8], format: ObjectFormat, ) -> Result<Self>
pub fn find(&self, oid: &ObjectId) -> Option<&PackIndexEntry>
pub fn write_v2_sha1( entries: &[PackIndexEntry], pack_checksum: &ObjectId, ) -> Result<Vec<u8>>
pub fn write_v2( format: ObjectFormat, entries: &[PackIndexEntry], pack_checksum: &ObjectId, ) -> Result<Vec<u8>>
Sourcepub fn write_v1(
format: ObjectFormat,
entries: &[PackIndexEntry],
pack_checksum: &ObjectId,
) -> Result<Vec<u8>>
pub fn write_v1( format: ObjectFormat, entries: &[PackIndexEntry], pack_checksum: &ObjectId, ) -> Result<Vec<u8>>
Serialise a version-1 pack .idx: a 256-entry fanout, then for each
object an inline 4-byte big-endian pack offset immediately followed by
its object id (sorted by oid), then the pack checksum and a trailing
index checksum. v1 has no CRC table and cannot represent offsets that
do not fit in 32 bits.