Skip to main content

Module pager

Module pager 

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

Explicit pager for cold data. See doc/developer/design/20260504_pager.md.

Structs§

Handle
An opaque handle to data paged out via pageout. The handle’s backend variant is fixed at pageout time and is independent of any later set_backend call.

Enums§

Backend
Selects which backend stores paged-out data.

Functions§

backend
Returns the currently active backend.
pageout
Scatter pageout. Logical layout = chunks concatenated in order. After return, each Vec in chunks is empty. File backend preserves capacity; swap backend moves the alloc into the handle. Empty input returns a len == 0 handle of the active backend’s variant (no I/O is performed in either backend).
pageout_with
Same as pageout, but selects the backend explicitly. Bypasses the global atomic so callers (such as the column-pager layer) can dispatch per call without racing other writers.
read_at
Reads a single range. Convenience wrapper around read_at_many.
read_at_many
Reads multiple ranges. Output appended to dst in request order (concat).
set_backend
Sets the active backend for future pageout calls. Existing handles are unaffected.
set_scratch_dir
Configures the scratch directory for the file backend.
take
Consumes handle, writing the entire payload into dst (cleared first), then reclaims storage. Swap fast path: single-chunk handle into empty dst swaps in place, no copy.
try_pageout
Fallible counterpart to pageout. Returns the underlying I/O error instead of panicking. The swap backend cannot fail at I/O, so this is equivalent to Ok(pageout(chunks)) when backend is Backend::Swap.
try_pageout_with
Fallible counterpart to pageout_with.
try_read_at
Fallible counterpart to read_at.
try_read_at_many
Fallible counterpart to read_at_many. Caller-side preconditions (out-of-bounds, overlapping ranges) still panic; I/O failures return Err.
try_take
Fallible counterpart to take. On I/O error the handle is consumed and dst may hold partial data; the scratch file is unlinked on inner drop.