Skip to main content

oxirs_arq/
parallel_types.rs

1//! Parallel execution types, statistics, and traits.
2
3use crate::algebra::{Binding, Solution};
4use anyhow::Result;
5
6/// Parallel execution statistics
7#[derive(Debug, Default)]
8pub struct ParallelStats {
9    pub parallel_operations: usize,
10    pub work_items_processed: usize,
11    pub thread_utilization: f64,
12    pub parallel_speedup: f64,
13    pub cache_hits: usize,
14    pub cache_misses: usize,
15}
16
17/// Parallel iterator for solution processing
18pub trait ParallelSolutionIterator: Send + Sync {
19    fn par_process<F>(&self, f: F) -> Result<Solution>
20    where
21        F: Fn(&Binding) -> Option<Binding> + Send + Sync;
22
23    fn par_filter<F>(&self, f: F) -> Result<Solution>
24    where
25        F: Fn(&Binding) -> bool + Send + Sync;
26
27    fn par_extend<F>(&self, f: F) -> Result<Solution>
28    where
29        F: Fn(&Binding) -> Vec<Binding> + Send + Sync;
30}