SharedCompressorState

Struct SharedCompressorState 

Source
pub struct SharedCompressorState {
Show 22 fields pub processed_bases: AtomicUsize, pub processed_samples: AtomicUsize, pub raw_contigs: Mutex<Vec<(String, String, Vec<u8>)>>, pub verbosity: usize, pub buffered_segments: Arc<Mutex<BufferedSegments>>, pub splitters: Arc<Mutex<AHashSet<u64>>>, pub bloom_splitters: Arc<Mutex<BloomFilter>>, pub vv_splitters: Mutex<Vec<Vec<u64>>>, pub v_candidate_kmers: Vec<u64>, pub v_duplicated_kmers: Vec<u64>, pub kmer_length: usize, pub adaptive_mode: bool, pub map_segments: Arc<Mutex<AHashMap<(u64, u64), u32>>>, pub map_segments_terminators: Arc<Mutex<AHashMap<u64, Vec<u64>>>>, pub concatenated_genomes: bool, pub no_segments: Arc<Mutex<u32>>, pub no_raw_groups: u32, pub archive: Option<Arc<Mutex<Archive>>>, pub v_segments: Arc<Mutex<Vec<Option<SegmentGroup>>>>, pub collection: Option<Arc<Mutex<CollectionV3>>>, pub aux_queue: Arc<BoundedPriorityQueue<Task>>, pub working_queue: Mutex<Arc<BoundedPriorityQueue<Task>>>,
}
Expand description

Shared state accessible to all worker threads

This matches C++ AGC’s shared variables captured by lambda (agc_compressor.cpp:1099):

  • Atomic counters (processed_bases, processed_samples)
  • Mutexes for shared collections (v_raw_contigs, vv_fallback_minimizers, etc.)
  • Archive writer, collection descriptor, etc.

Fields§

§processed_bases: AtomicUsize

Total bases processed (for progress tracking)

§processed_samples: AtomicUsize

Number of samples processed (for progress tracking)

§raw_contigs: Mutex<Vec<(String, String, Vec<u8>)>>

Contigs that failed to compress well (need adaptive splitters) Matches C++ AGC’s v_raw_contigs (protected by mtx_raw_contigs)

§verbosity: usize

Verbosity level (0 = quiet, 1 = normal, 2 = verbose)

§buffered_segments: Arc<Mutex<BufferedSegments>>

Buffered segments (KNOWN + NEW) Matches C++ AGC’s CBufferedSegPart buffered_seg_part

§splitters: Arc<Mutex<AHashSet<u64>>>

Splitter k-mers (exact set) Matches C++ AGC’s hs_splitters

§bloom_splitters: Arc<Mutex<BloomFilter>>

Bloom filter for splitters (fast probabilistic check) Matches C++ AGC’s bloom_splitters

§vv_splitters: Mutex<Vec<Vec<u64>>>

Per-thread vectors for accumulating new splitters (adaptive mode) Matches C++ AGC’s vv_splitters (agc_compressor.h:721) Each worker thread accumulates splitters, then merges at barrier

§v_candidate_kmers: Vec<u64>

Reference genome singleton k-mers (for adaptive mode exclusion) Matches C++ AGC’s v_candidate_kmers (agc_compressor.h:708) Sorted for efficient set_difference operations

§v_duplicated_kmers: Vec<u64>

Reference genome duplicated k-mers (for adaptive mode exclusion) Matches C++ AGC’s v_duplicated_kmers (agc_compressor.h:710) Sorted for efficient set_difference operations

§kmer_length: usize

K-mer length for segmentation

§adaptive_mode: bool

Adaptive compression mode (find new splitters for hard contigs)

§map_segments: Arc<Mutex<AHashMap<(u64, u64), u32>>>

Map: (kmer1, kmer2) → group_id Matches C++ AGC’s map_segments Lower group_id wins when same (k1, k2) pair (earlier samples are reference)

§map_segments_terminators: Arc<Mutex<AHashMap<u64, Vec<u64>>>>

Map: kmer → Vec (sorted terminators) Matches C++ AGC’s map_segments_terminators Used for split detection: find shared terminators between k1 and k2

§concatenated_genomes: bool

Concatenated genomes mode (treat all contigs as one sample)

§no_segments: Arc<Mutex<u32>>

Total number of segment groups (assigned group IDs) Matches C++ AGC’s no_segments

§no_raw_groups: u32

Number of raw groups (groups without LZ encoding) Matches C++ AGC’s no_raw_groups

§archive: Option<Arc<Mutex<Archive>>>

Archive writer for segment output Matches C++ AGC’s out_archive

§v_segments: Arc<Mutex<Vec<Option<SegmentGroup>>>>

Segment groups indexed by group_id Matches C++ AGC’s v_segments (vector<CSegment*>) Lazily created when first segment arrives for that group

§collection: Option<Arc<Mutex<CollectionV3>>>

Collection metadata for samples/contigs/segments Matches C++ AGC’s collection_desc

§aux_queue: Arc<BoundedPriorityQueue<Task>>

Auxiliary queue for adaptive mode (re-enqueue hard contigs) Matches C++ AGC’s pq_contigs_desc_aux

§working_queue: Mutex<Arc<BoundedPriorityQueue<Task>>>

Working queue pointer (switches between main and aux) Matches C++ AGC’s pq_contigs_desc_working

Implementations§

Source§

impl SharedCompressorState

Source

pub fn new( verbosity: usize, kmer_length: usize, adaptive_mode: bool, concatenated_genomes: bool, no_raw_groups: u32, main_queue: Arc<BoundedPriorityQueue<Task>>, ) -> Self

Create new shared state

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.