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 atpageouttime and is independent of any laterset_backendcall.
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
Vecinchunksis empty. File backend preserves capacity; swap backend moves the alloc into the handle. Empty input returns alen == 0handle 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
dstin request order (concat). - set_
backend - Sets the active backend for future
pageoutcalls. 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 emptydstswaps 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 toOk(pageout(chunks))whenbackendisBackend::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 returnErr. - try_
take - Fallible counterpart to
take. On I/O error the handle is consumed anddstmay hold partial data; the scratch file is unlinked on inner drop.