Skip to main content

gix_pack/multi_index/
mod.rs

1use std::path::PathBuf;
2
3use crate::MMap;
4
5/// Known multi-index file versions
6#[derive(Default, PartialEq, Eq, Ord, PartialOrd, Debug, Hash, Clone, Copy)]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8#[expect(missing_docs)]
9pub enum Version {
10    #[default]
11    V1 = 1,
12}
13
14/// An index into our [`File::index_names()`] array yielding the name of the index and by implication, its pack file.
15pub type PackIndex = u32;
16
17/// The type for referring to indices of an entry within the index file.
18pub type EntryIndex = u32;
19
20/// A representation of an index file for multiple packs at the same time, typically stored in a file
21/// named 'multi-pack-index'.
22pub struct File<T = MMap> {
23    data: T,
24    path: std::path::PathBuf,
25    version: Version,
26    hash_len: usize,
27    object_hash: gix_hash::Kind,
28    /// The amount of pack files contained within
29    num_indices: u32,
30    num_objects: u32,
31    /// If `Some(limit)`, the maximum size of a single allocation caused by user-controlled on-disk pack data.
32    alloc_limit_bytes: Option<usize>,
33
34    fan: [u32; 256],
35    index_names: Vec<PathBuf>,
36    lookup_ofs: usize,
37    offsets_ofs: usize,
38    large_offsets_ofs: Option<usize>,
39}
40
41///
42pub mod write;
43pub use write::function::write_from_index_paths;
44
45///
46mod access;
47
48///
49pub mod verify;
50
51///
52pub mod chunk;
53
54///
55pub mod init;