Skip to main content

validate_shard

Function validate_shard 

Source
pub fn validate_shard(
    path: &Path,
    manifest: Option<&ShardManifest>,
) -> ValidationReport
Expand description

Validate an entire shard file.

Reads the file line-by-line, validates each event, detects truncation, and optionally checks the shard manifest for integrity.

Valid events before a corrupt line are preserved in the report’s passed count. The validator does not stop at the first error — it continues through the entire file.

§Parameters

  • path: Path to the .events shard file.
  • manifest: Optional ShardManifest for file-level integrity checks. If provided, the file’s BLAKE3 hash, byte length, and event count are verified against the manifest.

§Panics

Does not panic. I/O errors produce a single ValidationError with kind: InvalidUtf8 (for encoding errors) or a report with zero passed/failed (for missing files).