git_pack/multi_index/
mod.rs

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