pub struct Ctx {
pub client: Client,
pub depth: Depth,
pub lang: Lang,
pub claimed_model: String,
pub rng: Mutex<Rng>,
pub perf: Mutex<Vec<PerfSample>>,
pub billing: Mutex<Vec<BillingRound>>,
pub headers: Mutex<Vec<BTreeMap<String, String>>>,
pub message_ids: Mutex<Vec<String>>,
pub raw_bodies: Mutex<Vec<String>>,
pub reachable: Mutex<bool>,
}Expand description
Shared state.
Probes run sequentially and nothing here is ever contended, so the lock is
not buying mutual exclusion — it is buying Sync. This used to be
RefCell, which made every probe future !Send and therefore impossible to
await from a multi-threaded runtime: an embedded caller (a request handler
spawning a verification) could not hold the future at all. Nothing may hold
one of these guards across an .await; each site below takes it, reads or
pushes, and drops it in the same expression.
Fields§
§client: Client§depth: Depth§lang: Lang§claimed_model: String§rng: Mutex<Rng>§perf: Mutex<Vec<PerfSample>>§billing: Mutex<Vec<BillingRound>>§headers: Mutex<Vec<BTreeMap<String, String>>>Response headers from every successful call, for channel classification.
message_ids: Mutex<Vec<String>>§raw_bodies: Mutex<Vec<String>>§reachable: Mutex<bool>Set by the preflight probe; when false the rest of the run is pointless.
Implementations§
Source§impl Ctx
impl Ctx
pub fn new( client: Client, depth: Depth, lang: Lang, claimed_model: String, ) -> Self
Sourcepub fn with_rng(
client: Client,
depth: Depth,
lang: Lang,
claimed_model: String,
rng: Rng,
) -> Self
pub fn with_rng( client: Client, depth: Depth, lang: Lang, claimed_model: String, rng: Rng, ) -> Self
The same, on a caller-chosen random source — see Rng::from_seed.
Sourcepub fn observe(&self, raw: &RawResponse, id: &str)
pub fn observe(&self, raw: &RawResponse, id: &str)
Record everything a later probe might want from a raw response.
pub fn add_perf(&self, sample: PerfSample)
Sourcepub fn is_reachable(&self) -> bool
pub fn is_reachable(&self) -> bool
Whether the endpoint answered the preflight probe at all.