pub struct CountsMatrix { /* private fields */ }Expand description
Cumulative per-destination row counts at every block boundary.
Row b of the grid holds, for each destination label d, the number of
source rows labeled d in blocks 0..=b. The final row therefore holds
the total row count of every destination. Deleted (NULL-labeled) rows are
not counted; the deleted count of a block is implied by
block length - sum of per-label deltas.
Implementations§
Source§impl CountsMatrix
impl CountsMatrix
pub fn num_destinations(&self) -> u32
pub fn block_rows(&self) -> u32
pub fn total_rows(&self) -> u64
pub fn num_blocks(&self) -> usize
Sourcepub fn block_range(&self, block: usize) -> Range<u64> ⓘ
pub fn block_range(&self, block: usize) -> Range<u64> ⓘ
The physical source row range covered by block.
Sourcepub fn count_before(&self, block: usize, label: u16) -> u32
pub fn count_before(&self, block: usize, label: u16) -> u32
Rows labeled label in blocks before block: the destination offset
of the first label-row inside block.
Sourcepub fn counters_at_block(&self, block: usize) -> Vec<u32>
pub fn counters_at_block(&self, block: usize) -> Vec<u32>
Per-label counters at the start of block, seeding a
SweepTranslator.
Sourcepub fn total(&self, label: u16) -> u32
pub fn total(&self, label: u16) -> u32
Total rows of destination label; the final cumulative row.
Sourcepub fn total_live_rows(&self) -> u64
pub fn total_live_rows(&self) -> u64
Total live (labeled) rows across all destinations.
Sourcepub fn deleted_through(&self, block: usize) -> u64
pub fn deleted_through(&self, block: usize) -> u64
Deleted (NULL-labeled) rows in blocks 0..=block.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Check internal consistency: per-label counts must be non-decreasing across blocks and each block’s live rows must fit its row range. O(num_blocks * num_destinations), no label IO. Called when a row map is opened, so a corrupt counts buffer fails loudly instead of translating rows to wrong addresses.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Serialize to the on-disk form stored in the row map file’s global buffer: a fixed header naming the representation, then the cumulative counts as little-endian u32.
Sourcepub fn decode(buf: &[u8]) -> Result<Self>
pub fn decode(buf: &[u8]) -> Result<Self>
Decode the on-disk form, checking structure exactly: magic, version, a
supported representation, shape legality and precise payload length.
Content invariants (monotone counts, per-block row budgets) are
checked by Self::validate.
Trait Implementations§
Source§impl Clone for CountsMatrix
impl Clone for CountsMatrix
Source§impl Debug for CountsMatrix
impl Debug for CountsMatrix
Source§impl DeepSizeOf for CountsMatrix
impl DeepSizeOf for CountsMatrix
fn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of(&self) -> usize
impl Eq for CountsMatrix
Source§impl PartialEq for CountsMatrix
impl PartialEq for CountsMatrix
impl StructuralPartialEq for CountsMatrix
Auto Trait Implementations§
impl Freeze for CountsMatrix
impl RefUnwindSafe for CountsMatrix
impl Send for CountsMatrix
impl Sync for CountsMatrix
impl Unpin for CountsMatrix
impl UnsafeUnpin for CountsMatrix
impl UnwindSafe for CountsMatrix
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.