Expand description
Resource rules for heavy computation.
One place for what every expensive job must obey:
- Memory budget. A job estimates its bytes and takes a weighted permit before it allocates; a single job larger than the budget is refused up front with the reason, instead of exhausting RAM halfway.
- Threads. A rayon pool sized by cores and budget. Parallel work is
maponly; floating-point accumulation runs in its original order, so results do not depend on the thread count. - Cancellation and progress. A cooperative cancel token checked at stage, channel, input and iteration boundaries, and a progress sink that reports stage, done/total and an ETA from the observed rate.
The available-memory probe is a seam (MemoryProbe): the app injects the
OS adapter from secs-sys; tests inject a fixed value.
Structs§
- Cancel
Token - Cooperative cancellation shared by a job and everything it starts.
- Cancelled
- A computation was cooperatively cancelled.
- Context
- Cancellation, progress, threads and memory available to one heavy job.
- Fixed
Memory - A fixed memory reading, useful for tests and deterministic callers.
- Memory
Budget - A weighted byte budget shared by concurrent work.
- Memory
Permit - A byte reservation which releases itself on drop.
- NoProgress
- A sink that drops every progress report.
- Progress
- One progress report.
- Stage
Progress - Progress tracker for one stage.
Enums§
- MapError
- Failure from an ordered fallible map.
- Memory
Error - Failure to reserve bytes from a
MemoryBudget.
Traits§
- Memory
Probe - Reports the memory currently available to the process.
- Progress
Sink - Destination for progress reports.