Skip to main content

Module utils

Module utils 

Source

Structs§

SizeFilter
A size filter with operator (e.g., >=1GB, <500KB).
TimeFilter
A time filter with operator (e.g., >=7d, <2026-05-01).

Enums§

DiskFreeThreshold
Threshold for disk space pre-check. Percent(pct) — warn when free space drops below pct% of total. Bytes(n) — warn when free space drops below n bytes.
SizeOp
Size comparison operator.
TimeOp
Time comparison operator.

Traits§

TimeFilterExt
Extension trait for TimeFilter to provide matching and classification methods.

Functions§

cmd_to_log_name
Convert a monitored path to a deterministic, fixed-length log filename. Resolve log filename from cmd name. "_global""_global_log.jsonl", "openclaw""openclaw_log.jsonl".
format_datetime
Format a DateTime<Utc> for display in local timezone.
format_size
Format size (in bytes) to human-readable string.
get_process_info_by_pid
Get process info by PID (from fanotify event) Checks proc connector cache first (for short-lived processes), then falls back to /proc (for long-lived processes), then falls back to file owner for USER.
parse_disk_min_free
Parse a --disk-min-free style value. “10%” → DiskFreeThreshold::Percent(10.0) “5GB” → DiskFreeThreshold::Bytes(5_368_709_120) “500MB” → DiskFreeThreshold::Bytes(524_288_000)
parse_size
Parse human-readable size string to bytes.
parse_size_filter
Parse a size filter string like ">=1GB", "<500KB", "=0".
parse_time
Parse human-readable time string to DateTime<Utc>.
parse_time_filter
Parse a time filter string like ">=7d", "<2h", "=2026-05-01".