MCPcopy Create free account
hub / github.com/ArcInstitute/binseq / ParallelProcessor

Interface ParallelProcessor

src/parallel.rs:209–239  ·  view source on GitHub ↗

Trait for types that can process records in parallel. This is implemented by the **processor** not by the **reader**. For the **reader**, see the [`ParallelReader`] trait.

Source from the content-addressed store, hash-verified

207/// This is implemented by the **processor** not by the **reader**.
208/// For the **reader**, see the [`ParallelReader`] trait.
209pub trait ParallelProcessor: Send + Clone {
210 /// Process a single record
211 fn process_record<R: BinseqRecord>(&mut self, record: R) -> Result<()>;
212
213 /// Called when a thread finishes processing its batch
214 /// Default implementation does nothing
215 #[allow(unused_variables)]
216 fn on_batch_complete(&mut self) -> Result<()> {
217 Ok(())
218 }
219
220 /// Called when a thread finished processing all its batches
221 /// Default implementation does nothing
222 #[allow(unused_variables)]
223 fn on_thread_complete(&mut self) -> Result<()> {
224 Ok(())
225 }
226
227 /// Set the thread ID for this processor
228 ///
229 /// Each thread should call this method with its own unique ID.
230 #[allow(unused_variables)]
231 fn set_tid(&mut self, _tid: usize) {
232 // Default implementation does nothing
233 }
234
235 /// Get the thread ID for this processor
236 fn get_tid(&self) -> Option<usize> {
237 None
238 }
239}
240
241#[cfg(test)]
242mod testing {

Callers 5

Implementers 10

parallel.rssrc/parallel.rs
fastx.rssrc/utils/fastx.rs
reader.rssrc/bq/reader.rs
reader.rssrc/vbq/reader.rs
read.rssrc/cbq/read.rs
read.rsexamples/read.rs
write.rsexamples/write.rs
parallel_range.rsexamples/parallel_range.rs
grep.rsexamples/grep.rs

Calls

no outgoing calls

Tested by

no test coverage detected