gix_pack/bundle/
mod.rs

1///
2pub mod init;
3
4mod find;
5///
6#[cfg(all(not(feature = "wasm"), feature = "streaming-input"))]
7pub mod write;
8
9///
10pub mod verify {
11    use std::sync::atomic::AtomicBool;
12
13    use gix_features::progress::DynNestedProgress;
14
15    ///
16    pub mod integrity {
17        /// Returned by [`Bundle::verify_integrity()`][crate::Bundle::verify_integrity()].
18        pub struct Outcome {
19            /// The computed checksum of the index which matched the stored one.
20            pub actual_index_checksum: gix_hash::ObjectId,
21            /// The packs traversal outcome
22            pub pack_traverse_outcome: crate::index::traverse::Statistics,
23        }
24    }
25
26    use crate::Bundle;
27
28    impl Bundle {
29        /// Similar to [`crate::index::File::verify_integrity()`] but more convenient to call as the presence of the
30        /// pack file is a given.
31        pub fn verify_integrity<C, F>(
32            &self,
33            progress: &mut dyn DynNestedProgress,
34            should_interrupt: &AtomicBool,
35            options: crate::index::verify::integrity::Options<F>,
36        ) -> Result<integrity::Outcome, crate::index::traverse::Error<crate::index::verify::integrity::Error>>
37        where
38            C: crate::cache::DecodeEntry,
39            F: Fn() -> C + Send + Clone,
40        {
41            self.index
42                .verify_integrity(
43                    Some(crate::index::verify::PackContext {
44                        data: &self.pack,
45                        options,
46                    }),
47                    progress,
48                    should_interrupt,
49                )
50                .map(|o| integrity::Outcome {
51                    actual_index_checksum: o.actual_index_checksum,
52                    pack_traverse_outcome: o.pack_traverse_statistics.expect("pack is set"),
53                })
54        }
55    }
56}