pub struct SSTableValidator {
pub expected_magic: u64,
pub verify_full_checksum: bool,
pub expected_checksum: Option<[u8; 32]>,
}Expand description
SSTable validator for pre-mmap validation
Fields§
§expected_magic: u64Expected magic number (default: MAGIC_NUMBER)
verify_full_checksum: boolWhether to perform full file checksum (expensive, optional)
expected_checksum: Option<[u8; 32]>Expected file checksum (if known from metadata)
Implementations§
Source§impl SSTableValidator
impl SSTableValidator
Sourcepub fn with_checksum_verification(expected_checksum: [u8; 32]) -> Self
pub fn with_checksum_verification(expected_checksum: [u8; 32]) -> Self
Create validator with full checksum verification enabled
Sourcepub fn validate_before_mmap(&self, file: &mut File) -> Result<()>
pub fn validate_before_mmap(&self, file: &mut File) -> Result<()>
Validate SSTable file before memory mapping
This performs comprehensive validation WITHOUT mmap to establish safety invariants:
- File size >= minimum (header + footer)
- Magic number matches expected value
- Footer is readable and well-formed
- Optional: Full file checksum (if verify_full_checksum = true)
Performance cost: ~5-10ms for basic validation, ~50-100ms for full checksum
Safety benefit: Prevents segfaults from corrupted/truncated files
Sourcepub fn validate_fast(&self, file: &mut File) -> Result<()>
pub fn validate_fast(&self, file: &mut File) -> Result<()>
Fast validation: only check magic number and file size
Performance: O(1) - reads only footer Use case: Production hot path where performance is critical
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SSTableValidator
impl RefUnwindSafe for SSTableValidator
impl Send for SSTableValidator
impl Sync for SSTableValidator
impl Unpin for SSTableValidator
impl UnsafeUnpin for SSTableValidator
impl UnwindSafe for SSTableValidator
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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