The backing-file freshness stamp: the identity a tracks row records for
its backing file, compared on every serve to detect an on-disk change that
no database write covers. Strengthened past size + whole-second mtime to
nanosecond mtime + ctime (#276) so a same-size in-place rewrite — including
an adversarial one that resets mtime — cannot evade the guard.
Optional syscall/query counters and per-syscall latency injection for
benchmarking. Zero-cost when the metrics feature is off: every hook
compiles to an empty inline fn, so call sites stay unconditional and clean.
A FUSE file handle: the sharded-slab key offset by one, so the wire value
is never 0 (0 on the wire means “no handle” — read falls back to inode
resolution).
A per-mount cache of resolved files keyed by track id; an entry
self-invalidates when the track’s content_version changes. Backed by
quick_cache: S3-FIFO eviction, byte-weighted, internally sharded.
The composed read-only filesystem: the store, the rendered tree, and the
lazy synthesis cache. All methods take &self; the tree is swapped
atomically on refresh, the cache is internally sharded (each shard mutex-guarded),
and the data-version stamp is atomic. This makes MusefsSync, so the FUSE
layer can later share it across a worker pool.
An owned view of an open handle’s backing fd, for FUSE passthrough
registration. Holds its own Arc<Handle>, so the fd outlives a concurrent
slab removal while the registration ioctl is in flight.
UI-agnostic progress callback for ScanOptions. Invoked only from the
caller’s thread (the walk and the single writer), never from probe workers.
The Send + Sync bound is not required by today’s code; it is deliberate
future-proofing and free here (indicatif::ProgressBar is Send + Sync).
The process-wide read-ahead allocator: one byte budget shared by all active
streams, with try_lock LRU eviction. Deadlock-free by construction — the
budget is a lock-free atomic, the registry lock is a leaf (released before any
buffer mutex), and eviction never blocks on a buffer mutex (try_lock + skip).
A parsed path template: literal runs, $field / ${field} substitutions
(with optional ${a|b} fallback chains and $!{field} slash-preserving path
fields), and [...] conditional sections. Parse once per mount; render
then costs one output String per call, with no re-parse.
An in-memory virtual filesystem tree: directories derived from path components
and files mapped to track ids. Inodes are stable for the lifetime of the tree.
with and with_poll may nest freely, on any variant: PerThread reads
hand out cloned Arcs from the pool-owned map, and the connection locks
are reentrant.
A progress event emitted during a scan or revalidate. Borrows the current
path to avoid a per-file allocation in the writer; the saved allocation is
negligible next to the existing per-file to_string_lossy + DB write, so do
not contort the API to preserve the borrow.
Re-validate an already-scanned library root: re-probe only files whose
size/mtime/ctime changed since the last scan (skipping unchanged ones so external
tag edits in the DB are preserved), then delete tracks under root whose
backing file is gone (cascading tags/art links) and garbage-collect
now-unreferenced art. root may be a single audio file (only that file is
revalidated) or a directory (walked recursively). Pruning is scoped to
root, so revalidating one library root never removes tracks belonging to
another.