pub struct ValidationPipeline { /* private fields */ }Expand description
Expected-cost validation pipeline with Bayesian ordering.
Implementations§
Source§impl ValidationPipeline
impl ValidationPipeline
Sourcepub fn with_config(config: PipelineConfig) -> Self
pub fn with_config(config: PipelineConfig) -> Self
Create a new pipeline with custom config.
Sourcepub fn register(
&mut self,
name: impl Into<String>,
initial_cost: Duration,
) -> usize
pub fn register( &mut self, name: impl Into<String>, initial_cost: Duration, ) -> usize
Register a validator with a name and initial cost estimate. Returns the assigned id.
Sourcepub fn compute_ordering(&self) -> (Vec<usize>, Vec<LedgerEntry>)
pub fn compute_ordering(&self) -> (Vec<usize>, Vec<LedgerEntry>)
Compute the optimal ordering (decreasing p/c score). Returns validator ids in execution order, plus the evidence ledger.
Sourcepub fn expected_cost(&self, ordering: &[usize]) -> f64
pub fn expected_cost(&self, ordering: &[usize]) -> f64
Compute the expected cost of a given ordering.
E[cost(π)] = Σ_k c_{π_k} × Π_{j<k} (1 − p_{π_j})Sourcepub fn update(&mut self, outcome: &ValidationOutcome)
pub fn update(&mut self, outcome: &ValidationOutcome)
Update a validator’s statistics after observing an outcome.
Sourcepub fn update_batch(&mut self, result: &PipelineResult)
pub fn update_batch(&mut self, result: &PipelineResult)
Update all validators from a pipeline result.
Sourcepub fn run<F>(&self, validate: F) -> PipelineResult
pub fn run<F>(&self, validate: F) -> PipelineResult
Simulate running the pipeline with provided validator functions.
Each function in validators corresponds to a registered validator
(by index). Returns a PipelineResult with the optimal ordering applied.
Sourcepub fn stats(&self, id: usize) -> Option<&ValidatorStats>
pub fn stats(&self, id: usize) -> Option<&ValidatorStats>
Get statistics for a validator by id.
Sourcepub fn all_stats(&self) -> &[ValidatorStats]
pub fn all_stats(&self) -> &[ValidatorStats]
Get all validator stats.
Sourcepub fn total_runs(&self) -> u64
pub fn total_runs(&self) -> u64
Total pipeline runs.
Sourcepub fn validator_count(&self) -> usize
pub fn validator_count(&self) -> usize
Number of registered validators.
Sourcepub fn summary(&self) -> PipelineSummary
pub fn summary(&self) -> PipelineSummary
Summary of current state (for diagnostics).
Trait Implementations§
Source§impl Clone for ValidationPipeline
impl Clone for ValidationPipeline
Source§fn clone(&self) -> ValidationPipeline
fn clone(&self) -> ValidationPipeline
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more