20260612 优化CIR在线累计恢复性能
This commit is contained in:
28
src/audit.rs
28
src/audit.rs
@@ -87,10 +87,6 @@ pub struct PublicationPointAudit {
|
||||
|
||||
pub warnings: Vec<AuditWarning>,
|
||||
pub objects: Vec<ObjectAuditEntry>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub cir_fresh_objects: Vec<ObjectAuditEntry>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub cir_cached_objects: Vec<ObjectAuditEntry>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
@@ -163,6 +159,30 @@ pub struct AuditDownloadStats {
|
||||
pub by_kind: std::collections::BTreeMap<String, AuditDownloadKindStats>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn publication_point_audit_serializes_object_audit_only() {
|
||||
let audit = PublicationPointAudit {
|
||||
objects: vec![ObjectAuditEntry {
|
||||
rsync_uri: "rsync://example.test/repo/fresh.roa".to_string(),
|
||||
sha256_hex: "11".repeat(32),
|
||||
kind: AuditObjectKind::Roa,
|
||||
result: AuditObjectResult::Ok,
|
||||
detail: None,
|
||||
}],
|
||||
..PublicationPointAudit::default()
|
||||
};
|
||||
|
||||
let value = serde_json::to_value(&audit).expect("serialize audit");
|
||||
assert!(value.get("objects").is_some());
|
||||
assert!(value.get("cir_fresh_objects").is_none());
|
||||
assert!(value.get("cir_cached_objects").is_none());
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize)]
|
||||
pub struct AuditRepoSyncStateStat {
|
||||
pub count: u64,
|
||||
|
||||
Reference in New Issue
Block a user