Skip to main content

parse_statistics_header

Function parse_statistics_header 

Source
pub fn parse_statistics_header(input: &[u8]) -> IResult<&[u8], StatisticsHeader>
Expand description

Parse the Statistics.db file header with authoritative format detection.

CQLite targets Cassandra 5.0 (na+/nb BIG, oa/da BTI); the supported header is the version-4 nb layout (the one the reader open path exercises via enhanced_statistics_parser):

  • Version 4: ‘nb’ enhanced-statistics header (Cassandra 5.0+)
    • Structure: version(4) + statistics_kind(4) + reserved(4) + data_length(4) + metadata1(4) + metadata2(4) + metadata3(4) + checksum(4) = 32 bytes
    • Authoritative marker: version == 4

This function successfully parses 1..=3 headers (pre-na, Cassandra 3.x/4.x) but those versions are UNSUPPORTED and OUT OF SCOPE per the version floor — they are REJECTED downstream by BigVersionGates::from_version / SSTableReader::open with Error::UnsupportedVersion, not here. The 1..=3 branch exists only so this standalone helper can parse a header structure without misclassifying a lower version; it SHALL NOT be relied on for correctness. Other versions (0, 5+) return a parse error.