1mod global_alloc;
2mod memory_manager;
3mod spill_context;
4mod spill_file;
5mod spill_frame;
6mod spill_token;
7
8pub use global_alloc::{Allocator, estimate_memory_usage};
9pub use memory_manager::memory_manager;
10use polars_utils::relaxed_cell::RelaxedCell;
11pub use spill_context::{
12 LeastRecentSpillContext, MostRecentSpillContext, ParameterFreeSpillContext, RandomSpillContext,
13 SpillContextParam, WeakSpillContext,
14};
15pub use spill_file::{flush_ooc_cleanup, init_ooc_cleaner};
16pub use spill_frame::{PinnedFrameMut, SpillFrame};
17pub use spill_token::{PinnedMut, PinnedRef, SpillToken};
18
19pub trait Spillable: Send + Sync + 'static {
20 type Spilled;
21
22 fn estimate_byte_size(&self) -> usize;
24
25 fn spill(&self, context_id: &str) -> impl Future<Output = Self::Spilled> + Send;
27
28 fn unspill(location: &Self::Spilled) -> impl Future<Output = Self> + Send;
30}
31
32static BYTES_SPILLED_TO_DISK: RelaxedCell<u64> = RelaxedCell::new_u64(0);