diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-05 17:29:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-05 17:29:12 +0900 |
| commit | 49b0884701a84731652fc934d428932ff6029bd4 (patch) | |
| tree | 7477029b8ed686b9b3b06d960cab2b54ba87b579 /crates/mozart-registry/src/cache.rs | |
| parent | 4623874d1c95414dcd5ae194d2561f2d98b40982 (diff) | |
| download | php-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.gz php-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.zst php-mozart-49b0884701a84731652fc934d428932ff6029bd4.zip | |
chore: remove redundant comments
Diffstat (limited to 'crates/mozart-registry/src/cache.rs')
| -rw-r--r-- | crates/mozart-registry/src/cache.rs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/crates/mozart-registry/src/cache.rs b/crates/mozart-registry/src/cache.rs index 9b7d165..62efd02 100644 --- a/crates/mozart-registry/src/cache.rs +++ b/crates/mozart-registry/src/cache.rs @@ -12,10 +12,6 @@ use std::fs; use std::path::{Path, PathBuf}; use std::time::{SystemTime, UNIX_EPOCH}; -// ───────────────────────────────────────────────────────────────────────────── -// CacheConfig -// ───────────────────────────────────────────────────────────────────────────── - /// Configuration for the Mozart cache system. pub struct CacheConfig { /// Root cache directory (e.g. `~/.cache/mozart`). @@ -93,10 +89,6 @@ fn dirs_cache_dir() -> PathBuf { PathBuf::from("/tmp") } -// ───────────────────────────────────────────────────────────────────────────── -// Cache -// ───────────────────────────────────────────────────────────────────────────── - /// A single cache bucket (a directory on disk). #[derive(Clone)] pub struct Cache { @@ -328,10 +320,6 @@ fn collect_files(dir: &Path, out: &mut Vec<(PathBuf, u64, u64)>) -> anyhow::Resu Ok(()) } -// ───────────────────────────────────────────────────────────────────────────── -// Probabilistic GC trigger -// ───────────────────────────────────────────────────────────────────────────── - /// Return `true` with a probability of 1 in 50 (based on system time nanos). /// /// Used to decide whether to run GC after an install/update operation. @@ -343,18 +331,12 @@ pub fn gc_is_necessary() -> bool { nanos.is_multiple_of(50) } -// ───────────────────────────────────────────────────────────────────────────── -// Tests -// ───────────────────────────────────────────────────────────────────────────── - #[cfg(test)] mod tests { use super::*; use std::time::Duration; use tempfile::tempdir; - // ──────────── sanitize_key ──────────── - #[test] fn test_sanitize_key_replaces_slash() { assert_eq!(Cache::sanitize_key("vendor/package"), "vendor~package"); @@ -380,8 +362,6 @@ mod tests { ); } - // ──────────── read/write roundtrip (string) ──────────── - #[test] fn test_write_read_roundtrip_string() { let dir = tempdir().unwrap(); @@ -392,8 +372,6 @@ mod tests { assert_eq!(result.as_deref(), Some("hello world")); } - // ──────────── read/write roundtrip (bytes) ──────────── - #[test] fn test_write_read_roundtrip_bytes() { let dir = tempdir().unwrap(); @@ -405,8 +383,6 @@ mod tests { assert_eq!(result, Some(data)); } - // ──────────── clear removes all entries ──────────── - #[test] fn test_clear_removes_all_entries() { let dir = tempdir().unwrap(); @@ -423,8 +399,6 @@ mod tests { assert!(cache.read("key2").is_none()); } - // ──────────── disabled cache returns None ──────────── - #[test] fn test_disabled_cache_returns_none() { let dir = tempdir().unwrap(); @@ -438,8 +412,6 @@ mod tests { assert!(cache.read_bytes("key").is_none()); } - // ──────────── GC with TTL expiration ──────────── - #[test] fn test_gc_ttl_expiration() { let dir = tempdir().unwrap(); @@ -471,8 +443,6 @@ mod tests { assert!(cache.read("new-key").is_some(), "fresh file should remain"); } - // ──────────── GC with size limit ──────────── - #[test] fn test_gc_size_limit() { let dir = tempdir().unwrap(); @@ -504,8 +474,6 @@ mod tests { ); } - // ──────────── gc_vcs (top-level subdir TTL deletion) ──────────── - #[test] fn test_gc_vcs_removes_old_subdirs() { let dir = tempdir().unwrap(); @@ -531,8 +499,6 @@ mod tests { assert!(new_mirror.exists(), "fresh mirror should remain"); } - // ──────────── age ──────────── - #[test] fn test_age_existing_entry() { let dir = tempdir().unwrap(); |
