Skip to main content

Module file

Module file 

Source
Available on crate feature pager and Unix only.
Expand description

File backend for the pager. See mz_ore::pager for the public API.

Stale-scratch cleanup is intentionally out of scope: production runs on Kubernetes with per-pod ephemeral volumes, so a crashed predecessor’s files are reclaimed with the volume. Local dev tooling is responsible for sweeping leftovers from crashed processes.

StructsΒ§

FileInner πŸ”’
Storage for a file-backed handle. The file at scratch_path(id) holds the bytes for non-empty handles. For len_u64s == 0, no file is created; drop is a no-op. No file descriptor is retained.

StaticsΒ§

INIT_LOCK πŸ”’
Serializes set_scratch_dir callers so init failures can be retried on the next call. A plain Once would burn the only retry opportunity.
SCRATCH_DIR πŸ”’
SCRATCH_ID πŸ”’
SUBDIR πŸ”’

FunctionsΒ§

alloc_scratch_id πŸ”’
coalesce πŸ”’
init_subdir πŸ”’
pageout_file πŸ”’
read_at_file πŸ”’
scratch_path πŸ”’
set_scratch_dir
Configures the scratch directory for the file backend.
take_file πŸ”’
try_pageout_file πŸ”’
Fallible counterpart to pageout_file. Returns the underlying I/O error instead of falling back to a different backend, so callers can distinguish β€œscratch volume is broken” from β€œeverything is fine.”
try_read_at_file πŸ”’
Fallible counterpart to read_at_file. Returns Err instead of panicking on I/O failure (open/pread errors). Bounds violations and non-file handles still panic β€” those are caller bugs, not I/O failures.
try_take_file πŸ”’
Fallible counterpart to take_file. Returns Err instead of panicking on I/O failure. The handle is consumed in either case; on Err, dst may hold partial data and the scratch file is unlinked when the inner is dropped.
write_all_vectored πŸ”’
write_chunks πŸ”’