pub struct EdgePopCoverage {
pub schema_version: u32,
pub entries: BTreeMap<String, EgressTargetPops>,
/* private fields */
}Expand description
Coverage map keyed by (egress_label, target_host).
The composite key is encoded as egress_label \u{1F} target_host
(ASCII unit separator). BTreeMap over the joined key gives stable
iteration order for deterministic save/load. Operators read the
map via pops_for / uncovered_pops without seeing the
internal key encoding.
Fields§
§schema_version: u32Schema version of the on-disk format.
entries: BTreeMap<String, EgressTargetPops>(egress_label, target_host) → observed POPs.
Implementations§
Source§impl EdgePopCoverage
impl EdgePopCoverage
Sourcepub fn set_exhaustion_threshold(&mut self, n: usize)
pub fn set_exhaustion_threshold(&mut self, n: usize)
Override the exhaustion threshold. Useful for tests, or for operators on extremely well-distributed proxy pools.
Sourcepub fn exhaustion_threshold(&self) -> usize
pub fn exhaustion_threshold(&self) -> usize
Current exhaustion threshold.
Sourcepub fn record(&mut self, egress: &str, target: &str, pop_raw: &str) -> bool
pub fn record(&mut self, egress: &str, target: &str, pop_raw: &str) -> bool
Record that we observed pop (must be a valid IATA-style
string — pass the raw signal.edge_pop from parse_cf_block).
Returns true if the POP was newly observed for this
(egress, target), false if already known.
Invalid POP strings (wrong length, non-letter) increment
total_probes but don’t add to the set — they’re noise from
non-CF responses (origin direct, captive portals, etc).
Sourcepub fn record_no_pop(&mut self, egress: &str, target: &str)
pub fn record_no_pop(&mut self, egress: &str, target: &str)
Record a probe with NO POP observed (e.g. timeout, non-CF edge, raw TCP error). Updates only the probe counter.
Sourcepub fn pops_for(&self, egress: &str, target: &str) -> BTreeSet<String>
pub fn pops_for(&self, egress: &str, target: &str) -> BTreeSet<String>
Look up observed POPs for this pair. Returns an empty set if the pair has never been probed.
Sourcepub fn probes_for(&self, egress: &str, target: &str) -> u64
pub fn probes_for(&self, egress: &str, target: &str) -> u64
Total probes recorded for this pair. Zero if never probed.
Sourcepub fn is_exhausted(&self, egress: &str, target: &str) -> bool
pub fn is_exhausted(&self, egress: &str, target: &str) -> bool
True if (egress, target) has hit at least
exhaustion_threshold distinct POPs and is unlikely to
surface more without major IP rotation.
Sourcepub fn pops_covered_for_target(&self, target: &str) -> BTreeSet<String>
pub fn pops_covered_for_target(&self, target: &str) -> BTreeSet<String>
All POPs seen across every egress for this target. Used to
answer “what’s the union of CF POPs our hunt has touched for
target.example”.
Sourcepub fn pops_covered_global(&self) -> BTreeSet<String>
pub fn pops_covered_global(&self) -> BTreeSet<String>
All POPs seen across every (egress, target). Useful for the global “we touched N distinct POPs this hunt round” headline.
Sourcepub fn egress_labels(&self) -> BTreeSet<String>
pub fn egress_labels(&self) -> BTreeSet<String>
All egress labels we have data for. Stable order (BTreeMap iteration).
Sourcepub fn rank_egresses_for_discovery(&self, target: &str) -> Vec<(String, usize)>
pub fn rank_egresses_for_discovery(&self, target: &str) -> Vec<(String, usize)>
Egress entries that are NOT yet exhausted for target —
these are the candidates the hunt loop should prioritize for
new probes, sorted ascending by current POP count so we
favor entries with the most room to grow.
Sourcepub fn save_atomic(&self, path: &Path) -> Result<()>
pub fn save_atomic(&self, path: &Path) -> Result<()>
Persist atomically via tempfile + rename. The on-disk format is JSON for human-readable diffs across hunt sessions.
R55 pass-19 I4 (CLAUDE.md §7 DEDUP): delegates to
wafrift_types::loaders::write_atomic so the atomic-write
recipe lives in one place. Pre-fix: 3 evolution modules each
rolled their own.
Sourcepub fn load_or_default(path: &Path) -> Self
pub fn load_or_default(path: &Path) -> Self
Load from disk; on missing file or corrupt JSON return
default(). Same forgiveness contract as
rule_corpus::load_or_default — operator data is precious
but a corrupt coverage map shouldn’t crash a hunt round.
Trait Implementations§
Source§impl Clone for EdgePopCoverage
impl Clone for EdgePopCoverage
Source§fn clone(&self) -> EdgePopCoverage
fn clone(&self) -> EdgePopCoverage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more