Skip to main content

parlov_probe/
lib.rs

1//! Probe engine for parlov: HTTP execution, TLS control, timing, and rate limiting.
2//!
3//! This crate owns the network-facing half of the pipeline. It pulls in the full async/HTTP/TLS
4//! stack so that changes to statistical thresholds in `parlov-analysis` do not trigger a
5//! recompile of `reqwest`, `hyper`, or `rustls`.
6//!
7//! # Trait contract
8//!
9//! Implementors of [`Probe`] execute one HTTP interaction and return a [`ResponseSurface`]. The
10//! scheduler in the binary crate handles batching, interleaving, and collecting samples,
11//! driven by the incremental `Analyzer::evaluate` loop in `parlov-analysis`.
12
13#![deny(clippy::all)]
14#![warn(clippy::pedantic)]
15#![deny(missing_docs)]
16
17pub mod http;
18
19use parlov_core::{Error, ProbeDefinition, ResponseSurface};
20
21/// Executes a single HTTP interaction and returns the full response surface.
22///
23/// One call to `execute` produces one [`ResponseSurface`]. The scheduler drives the
24/// `Analyzer::evaluate` loop in `parlov-analysis` and pairs results into a `ProbeSet`.
25///
26/// Implementations must be `Send + Sync` so they can be shared across async tasks.
27pub trait Probe: Send + Sync {
28    /// Execute one HTTP interaction described by `def` and return the full response surface.
29    fn execute(
30        &self,
31        def: &ProbeDefinition,
32    ) -> impl std::future::Future<Output = Result<ResponseSurface, Error>> + Send;
33}