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Β§
- File
Inner π - Storage for a file-backed handle. The file at
scratch_path(id)holds the bytes for non-empty handles. Forlen_u64s == 0, no file is created; drop is a no-op. No file descriptor is retained.
StaticsΒ§
- INIT_
LOCK π - Serializes
set_scratch_dircallers so init failures can be retried on the next call. A plainOncewould 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. ReturnsErrinstead 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. ReturnsErrinstead of panicking on I/O failure. The handle is consumed in either case; onErr,dstmay hold partial data and the scratch file is unlinked when the inner is dropped. - write_
all_ πvectored - write_
chunks π