-
-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frame for interity check on object store (#287)
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,9 @@ pub(crate) mod handle; | |
/// | ||
pub mod load_index; | ||
|
||
/// | ||
pub mod verify; | ||
|
||
mod load_one; | ||
|
||
mod metrics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use crate::pack; | ||
use git_features::progress::Progress; | ||
use std::sync::atomic::AtomicBool; | ||
|
||
#[allow(missing_docs, unused)] | ||
|
||
/// | ||
pub mod integrity { | ||
use crate::pack; | ||
|
||
/// Returned by [`Store::verify_integrity()`][crate::Store::verify_integrity()]. | ||
#[derive(Debug, thiserror::Error)] | ||
#[allow(missing_docs)] | ||
pub enum Error { | ||
#[error(transparent)] | ||
MultiIndex(#[from] pack::index::traverse::Error<pack::multi_index::verify::integrity::Error>), | ||
#[error(transparent)] | ||
Index(#[from] pack::index::traverse::Error<pack::index::verify::integrity::Error>), | ||
} | ||
|
||
/// Returned by [`Store::verify_integrity()`][crate::Store::verify_integrity()]. | ||
pub struct Outcome<P> { | ||
/// Pack traversal statistics for each pack whose objects were checked. | ||
pub pack_traverse_statistics: Vec<pack::index::traverse::Statistics>, | ||
/// The provided progress instance. | ||
pub progress: P, | ||
} | ||
} | ||
|
||
impl super::Store { | ||
/// Check the integrity of all objects as per the given `options`. | ||
/// | ||
/// Note that this will not not force loading all indices or packs permanently, as we will only use the momentarily loaded disk state. | ||
/// This does, however, include all alternates. | ||
pub fn verify_integrity<C, P, F>( | ||
&self, | ||
_progress: P, | ||
_should_interrupt: &AtomicBool, | ||
_options: pack::index::verify::integrity::Options<F>, | ||
) -> Result<integrity::Outcome<P>, pack::index::traverse::Error<integrity::Error>> | ||
where | ||
P: Progress, | ||
C: pack::cache::DecodeEntry, | ||
F: Fn() -> C + Send + Clone, | ||
{ | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters