pub struct StreamingQueueCompressor { /* private fields */ }Expand description
Streaming compressor with queue-based API
§Example
use ragc_core::{StreamingQueueCompressor, StreamingQueueConfig};
use std::collections::HashSet;
let config = StreamingQueueConfig::default();
let splitters = HashSet::new(); // Normally from reference
let mut compressor = StreamingQueueCompressor::with_splitters(
"output.agc",
config,
splitters
)?;
// Push sequences (blocks when queue is full - automatic backpressure!)
for (sample, contig_name, data) in sequences {
compressor.push(sample, contig_name, data)?;
}
// Finalize - waits for all compression to complete
compressor.finalize()?;Implementations§
Source§impl StreamingQueueCompressor
impl StreamingQueueCompressor
Sourcepub fn with_splitters(
output_path: impl AsRef<Path>,
config: StreamingQueueConfig,
splitters: HashSet<u64>,
) -> Result<Self>
pub fn with_splitters( output_path: impl AsRef<Path>, config: StreamingQueueConfig, splitters: HashSet<u64>, ) -> Result<Self>
Create a new streaming compressor with pre-computed splitters
Use this when you already have splitters (e.g., from a reference genome)
§Arguments
output_path- Path to output AGC archiveconfig- Compression configurationsplitters- Pre-computed splitter k-mers
Sourcepub fn new(
output_path: impl AsRef<Path>,
config: StreamingQueueConfig,
) -> Result<Self>
pub fn new( output_path: impl AsRef<Path>, config: StreamingQueueConfig, ) -> Result<Self>
Create compressor and determine splitters from first contig
Note: This requires at least one contig to be pushed before workers start.
Consider using with_splitters() instead if you have a reference genome.
Sourcepub fn push(
&mut self,
sample_name: String,
contig_name: String,
data: Contig,
) -> Result<()>
pub fn push( &mut self, sample_name: String, contig_name: String, data: Contig, ) -> Result<()>
Push a contig to the compression queue
BLOCKS if the queue is full (automatic backpressure!)
§Arguments
sample_name- Name of the samplecontig_name- Name of the contigdata- Contig sequence data (Vec)
§Example
compressor.push("sample1".to_string(), "chr1".to_string(), vec![b'A', b'T', b'G', b'C'])?;Sourcepub fn finalize(self) -> Result<()>
pub fn finalize(self) -> Result<()>
Finalize compression
This will:
- Close the queue (no more pushes allowed)
- Wait for all worker threads to finish processing
- Write metadata to the archive
- Close the archive file
§Example
// ... push sequences ...
compressor.finalize()?;Sourcepub fn queue_stats(&self) -> QueueStats
pub fn queue_stats(&self) -> QueueStats
Get current queue statistics
Auto Trait Implementations§
impl Freeze for StreamingQueueCompressor
impl !RefUnwindSafe for StreamingQueueCompressor
impl Send for StreamingQueueCompressor
impl Sync for StreamingQueueCompressor
impl Unpin for StreamingQueueCompressor
impl !UnwindSafe for StreamingQueueCompressor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more