subscription_proxy_pool/diagnostics.rs
1/// Result for an individual subscription source.
2#[derive(Clone, Copy, Debug, PartialEq, Eq)]
3pub enum SourceOutcome {
4 /// A new successful HTTP response replaced the source's nodes.
5 Updated,
6 /// HTTP 304 confirmed the existing nodes; no body download was needed.
7 NotModified,
8 /// Startup used a fresh disk cache without contacting the source.
9 FreshCache,
10 /// A failed fetch fell back to a still-allowed disk cache.
11 StaleCache,
12 /// A failed fetch retained the source's running in-memory nodes.
13 Retained,
14 /// No source data could be loaded.
15 Failed,
16}
17
18/// Per-source diagnostics. Keys are hashes; URLs and credentials are omitted.
19#[derive(Clone, Debug)]
20pub struct SourceReport {
21 /// Stable hash returned by SubscriptionSource::key().
22 pub source_key: String,
23 /// How this source was resolved.
24 pub outcome: SourceOutcome,
25 /// Number of usable nodes in this source, before cross-source deduplication.
26 pub nodes: usize,
27 /// Sanitized remote error, if this update failed.
28 pub error: Option<String>,
29 /// Sanitized cache I/O error, if caching failed.
30 pub cache_error: Option<String>,
31}
32
33/// Last completed refresh, available after build and background refresh too.
34#[derive(Clone, Debug, Default)]
35pub struct RefreshReport {
36 /// Unique nodes in the resulting pool.
37 pub nodes: usize,
38 /// Sources with changed, successfully parsed content.
39 pub updated_sources: usize,
40 /// Sources confirmed by HTTP 304.
41 pub not_modified_sources: usize,
42 /// Sources restored from disk.
43 pub cached_sources: usize,
44 /// Failed remote sources, including those with successful fallback.
45 pub failed_sources: usize,
46 /// Unsupported, duplicate or invalid parsed nodes.
47 pub skipped_nodes: usize,
48 /// Cache reads that failed due to filesystem errors.
49 pub cache_read_failures: usize,
50 /// Cache writes that failed after successful remote validation.
51 pub cache_write_failures: usize,
52 /// Details for each configured subscription, in configuration order.
53 pub sources: Vec<SourceReport>,
54}