This commit is contained in:
Mateusz Gruszczyński committed 2026-11-10 11:36:23 +01:00
1 parent e260612ef9
commit 643999f17e
25 files changed
+421 -86

No files matched your search

+21
View File
@@ -196,4 +196,25 @@ impl DomainStatsStore {
}
counters
}
fn scope_totals(&self) -> BTreeMap<String, ScopeCacheTotals> {
let published = self.domains.load();
let load = |value: &AtomicU64| value.load(Ordering::Relaxed);
published
.index
.iter()
.map(|(scope, domains)| {
let mut totals = ScopeCacheTotals::default();
for stats in domains.values() {
totals.hits = totals.hits.saturating_add(load(&stats.hits));
totals.misses = totals.misses.saturating_add(load(&stats.misses));
totals.bypasses = totals.bypasses.saturating_add(load(&stats.bypasses));
totals.saved_body_bytes = totals
.saved_body_bytes
.saturating_add(load(&stats.saved_body_bytes));
}
(scope.clone(), totals)
})
.collect()
}
}