Skip to main content

Module key

Module key 

Source
Expand description

Cache key for identifying parsed files.

The cache key uniquely identifies a file’s AST summary using:

  • Canonical file path (normalized, symlinks resolved)
  • Language identifier (plugin name)
  • Content hash (BLAKE3 digest)

§Path Canonicalization

Cache keys attempt to canonicalize paths to handle symlinks and relative paths consistently. If canonicalization fails (file deleted, permission denied, or unsupported filesystem), the key falls back to the original path.

§Examples

use sqry_core::cache::CacheKey;
use sqry_core::hash::Blake3Hash;
use std::path::PathBuf;

let hash_hex = "a".repeat(64);
let hash = Blake3Hash::from_hex(&hash_hex).unwrap();
let key = CacheKey::new(
    PathBuf::from("src/main.rs"),
    "rust",
    hash,
);

// Keys are comparable and hashable
assert_eq!(key.language(), "rust");

Structs§

CacheKey
Unique identifier for cached AST summaries.