Minor: Make "heuristic" predicate positive, and document

Make the partition "heuristic" predicate a positive match, in line with
the "systemic" predicate, and document its expected semantics for future
readers. Update the only call site to match.
This commit is contained in:
Gabriel Wicke 2026-01-07 09:59:46 -08:00
parent c9327ca851
commit 89f75b34ad
2 changed files with 4 additions and 2 deletions

View file

@ -14,9 +14,11 @@ pub struct Partition {
}
impl Partition {
// Match mount types that do not reliably emit change notifications, or update directory
// metadata on changes, and should be refreshed frequently / heuristically.
pub fn heuristic(&self) -> bool {
let b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes());
!matches!(b, b"exfat" | b"fuse.rclone")
matches!(b, b"exfat" | b"fuse.rclone")
}
#[rustfmt::skip]

View file

@ -70,7 +70,7 @@ impl VfsFiles for Files {
use std::io::ErrorKind;
match Cha::from_url(dir).await {
Ok(c) if !c.is_dir() => FilesOp::issue_error(dir, ErrorKind::NotADirectory).await,
Ok(c) if c.hits(cha) && PARTITIONS.read().heuristic(cha) => {}
Ok(c) if c.hits(cha) && !PARTITIONS.read().heuristic(cha) => {}
Ok(c) => return Some(c),
Err(e) => FilesOp::issue_error(dir, e).await,
}