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_sha1_with_limits( pack_bytes: &[u8], limits: PackReadLimits, ) -> Result<PackIndexBuild>
pub fn write_v2_for_pack( pack_bytes: &[u8], format: ObjectFormat, ) -> Result<PackIndexBuild>
pub fn write_v2_for_pack_with_limits( pack_bytes: &[u8], format: ObjectFormat, limits: PackReadLimits, ) -> Result<PackIndexBuild>
Sourcepub fn write_v2_for_pack_with_base<F>(
pack_bytes: &[u8],
format: ObjectFormat,
external_base: F,
) -> Result<PackIndexBuild>
pub fn write_v2_for_pack_with_base<F>( pack_bytes: &[u8], format: ObjectFormat, external_base: F, ) -> Result<PackIndexBuild>
Validate and index a pack while resolving ref-deltas against an external
object source. This powers index-pack --fix-thin; self-contained packs
use Self::write_v2_for_pack.
pub fn write_v2_for_pack_with_base_and_limits<F>( pack_bytes: &[u8], format: ObjectFormat, external_base: F, limits: PackReadLimits, ) -> 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_with_base<R, F>(
reader: &mut R,
format: ObjectFormat,
external_base: F,
) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_reader_with_base<R, F>( reader: &mut R, format: ObjectFormat, external_base: F, ) -> Result<PackStreamIndexBuild>
Self::write_v2_for_pack_reader with an external ref-delta resolver.
pub fn write_v2_for_pack_reader_with_limits<R>( reader: &mut R, format: ObjectFormat, limits: PackReadLimits, ) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_reader_with_base_and_limits<R, F>( reader: &mut R, format: ObjectFormat, external_base: F, limits: PackReadLimits, ) -> Result<PackStreamIndexBuild>
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.
Sourcepub fn write_v2_for_pack_reader_to_trailer_with_base<R, F>(
reader: &mut R,
format: ObjectFormat,
external_base: F,
) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_reader_to_trailer_with_base<R, F>( reader: &mut R, format: ObjectFormat, external_base: F, ) -> Result<PackStreamIndexBuild>
Self::write_v2_for_pack_reader_to_trailer with an external
ref-delta resolver.
pub fn write_v2_for_pack_reader_to_trailer_with_limits<R>(
reader: &mut R,
format: ObjectFormat,
limits: PackReadLimits,
) -> Result<PackStreamIndexBuild>where
R: Read,
pub fn write_v2_for_pack_reader_to_trailer_with_base_and_limits<R, F>( reader: &mut R, format: ObjectFormat, external_base: F, limits: PackReadLimits, ) -> Result<PackStreamIndexBuild>
Sourcepub fn write_v2_for_pack_reader_to_trailer_with_progress<R, F>(
reader: &mut R,
format: ObjectFormat,
progress: F,
) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_reader_to_trailer_with_progress<R, F>( reader: &mut R, format: ObjectFormat, progress: F, ) -> Result<PackStreamIndexBuild>
write_v2_for_pack_reader_to_trailer that reports streaming pack
progress. progress is invoked on a throttled cadence with the pack byte
offset, objects parsed so far, and the header-declared total, then once
more at completion with received_objects == total_objects.
pub fn write_v2_for_pack_reader_to_trailer_with_progress_and_limits<R, F>( reader: &mut R, format: ObjectFormat, limits: PackReadLimits, progress: F, ) -> Result<PackStreamIndexBuild>
Sourcepub fn write_v2_for_pack_reader_to_trailer_with_progress_and_cancel<R, F>(
reader: &mut R,
format: ObjectFormat,
cancel: CancelFlag<'_>,
progress: F,
) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_reader_to_trailer_with_progress_and_cancel<R, F>( reader: &mut R, format: ObjectFormat, cancel: CancelFlag<'_>, progress: F, ) -> Result<PackStreamIndexBuild>
Like Self::write_v2_for_pack_reader_to_trailer_with_progress, but
polls cancel cooperatively between pack objects (and after progress
emission). Returns GitError::Cancelled when the flag trips.
Progress callbacks remain side-effect only; cancellation is checked
independently and does not require the callback to return
sley_core::StreamControl.
pub fn write_v2_for_pack_reader_to_trailer_with_progress_and_cancel_and_limits<R, F>( reader: &mut R, format: ObjectFormat, cancel: CancelFlag<'_>, limits: PackReadLimits, progress: F, ) -> Result<PackStreamIndexBuild>
pub fn write_v2_for_pack_reader_with_len<R>(
reader: &mut R,
format: ObjectFormat,
pack_len: u64,
) -> Result<PackStreamIndexBuild>where
R: Read,
pub fn write_v2_for_pack_reader_with_len_and_limits<R>(
reader: &mut R,
format: ObjectFormat,
pack_len: u64,
limits: PackReadLimits,
) -> 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 write_v2_for_pack_path_with_limits( path: impl AsRef<Path>, format: ObjectFormat, limits: PackReadLimits, ) -> Result<PackStreamIndexBuild>
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.