logo
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//! Public data structures for pack index files
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;

/// The data for a single pack file
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PackFileRef {
    /// The path to the pack file relative to the installation
    pub path: String,
}

/// The data associated with each file
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
#[repr(C)]
pub struct FileRef {
    /// The category of this file. The least significant byte indicates whether
    /// the file should be compressed.
    pub category: u32,
    /// The index of the pack file in [`PackIndexFile::archives`]
    pub pack_file: u32,
}

/// The entire data in a PKI file
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PackIndexFile {
    /// The list of PK archive paths
    pub archives: Vec<PackFileRef>,
    /// The map from CRC to file metadata
    pub files: BTreeMap<u32, FileRef>,
}