Skip to main content

EdgePopCoverage

Struct EdgePopCoverage 

Source
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: u32

Schema version of the on-disk format.

§entries: BTreeMap<String, EgressTargetPops>

(egress_label, target_host) → observed POPs.

Implementations§

Source§

impl EdgePopCoverage

Source

pub fn new() -> Self

Construct an empty map at the current schema version.

Source

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.

Source

pub fn exhaustion_threshold(&self) -> usize

Current exhaustion threshold.

Source

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).

Source

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.

Source

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.

Source

pub fn probes_for(&self, egress: &str, target: &str) -> u64

Total probes recorded for this pair. Zero if never probed.

Source

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.

Source

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”.

Source

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.

Source

pub fn egress_labels(&self) -> BTreeSet<String>

All egress labels we have data for. Stable order (BTreeMap iteration).

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> EdgePopCoverage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EdgePopCoverage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EdgePopCoverage

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for EdgePopCoverage

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for EdgePopCoverage

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more