pub struct CacheConfig {
pub dir_capacity: Option<u64>,
pub dir_ttl_secs: Option<u64>,
pub file_size_capacity: Option<usize>,
pub proc_ttl_secs: Option<u64>,
pub channel_capacity: Option<usize>,
pub subscribe_buf: Option<usize>,
pub buffer_size: Option<usize>,
}Expand description
Cache configuration (optional — missing fields use code defaults).
Priority: CLI args > fsmon.toml > code defaults.
Fields§
§dir_capacity: Option<u64>Directory handle cache capacity (default: 100,000). Each entry ≈ 150-200 bytes. Lower this on memory-constrained systems, raise it when monitoring large directory trees (>100k dirs).
dir_ttl_secs: Option<u64>Directory handle cache TTL in seconds (default: 3600). Shorter TTL frees memory faster for volatile directory structures, longer TTL reduces handle re-resolution for stable directories.
file_size_capacity: Option<usize>File size cache capacity (default: 10,000). Each entry ≈ 80-120 bytes. Raise for high-file-volume workloads.
proc_ttl_secs: Option<u64>Process cache TTL in seconds (default: 600). Applies to both proc_cache and pid_tree. Shorter TTL cleans up zombie process entries faster; longer TTL reduces /proc reads.
channel_capacity: Option<usize>Event channel capacity between reader tasks and the main loop. Default: unbounded. Set to a finite number (e.g. 1024) to cap memory under extreme event storms — reader tasks block when the buffer is full, with fanotify overflow as final backstop.
subscribe_buf: Option<usize>Subscribe event stream buffer capacity. Number of events the broadcast channel can buffer before dropping oldest for slow subscribers. Default: 4096. Raise for high-throughput workloads with many subscribers.
buffer_size: Option<usize>Fanotify read buffer size in bytes (default: 32768). Raise for high-throughput event volumes.
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn resolve_with_cli(&self, cli: &CliCacheOverride) -> ResolvedCacheConfig
pub fn resolve_with_cli(&self, cli: &CliCacheOverride) -> ResolvedCacheConfig
Merge: explicit values from this config override defaults, then CLI overrides override config values.
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more