Skip to main content

Crate musefs_core

Crate musefs_core 

Source

Modules§

convert
Sanctioned integer conversions, justified by the 64-bit-only guard below.
freshness
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.
metrics
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.

Structs§

AllocatorStats
jemalloc allocator stats (present only on a jemalloc-feature build).
Attr
Attributes the FUSE layer maps onto fuser::FileAttr.
BackingReader
CoreTelemetry
Core-owned telemetry: the file-handle slab count, header/size caches, the virtual-tree footprint, and refresh health. Produced by Musefs::telemetry.
Fh
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).
FuseTelemetry
Fuse-owned telemetry: uptime, the read/dir-handle gates and their caps, the worker pool, and (Linux only) passthrough state.
HeaderCache
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.
MountConfig
Per-mount configuration for rendering the virtual hierarchy.
Musefs
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 Musefs Sync, so the FUSE layer can later share it across a worker pool.
Node
PassthroughFd
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.
PassthroughTelemetry
Passthrough sub-telemetry; None (in FuseTelemetry) off Linux.
ProgressSink
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).
ReadAhead
ReadAheadPool
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).
ResolvedFile
A fully resolved synthesized file: its segment layout, total size, the content version it was built from, and where the backing audio lives.
RevalidateStats
ScanOptions
Knobs for a scan. jobs == 0 means “use available parallelism”.
ScanStats
Template
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.
VirtualTree
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.

Enums§

ChecksumTier
How much checksum work a scan does per file.
CoreError
DbPool
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.
MatchStrictness
How a fingerprint match is confirmed before a retarget.
Mode
How the mount serves file contents. The virtual tree is identical either way.
NodeKind
ScanProgress
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.
TemplateError
Why a template was rejected at parse time. Surfaced to the operator via crate::CoreError::InvalidTemplate when Musefs::open parses a bad --template.

Functions§

read_at
Allocating form of read_at_into (tests and non-hot-path callers).
read_at_with_file
Allocating form of read_at_with_file_into.
render_prometheus
Render a full Prometheus exposition-format document. Feature-gated blocks (alloc, syscalls) are omitted entirely when their Option is None.
revalidate
Back-compat shim used by the CLI and existing tests.
revalidate_with
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.
scan_directory
Back-compat shim used by the CLI and existing tests.
scan_directory_with
Public entry: parallel-probe / single-writer scan of root.

Type Aliases§

Result