pub struct KvSpillManager { /* private fields */ }Expand description
2026-09-25: The swap files of one directory and their recorded size.
Implementations§
Source§impl KvSpillManager
impl KvSpillManager
Sourcepub fn new(spill_dir: PathBuf, max_bytes: u64) -> Result<Self>
pub fn new(spill_dir: PathBuf, max_bytes: u64) -> Result<Self>
2026-09-25: A manager for spill_dir with a max_bytes budget.
Creates the directory if it is missing; otherwise deletes the swap_*
files already in it, ignoring failures to delete.
Sourcepub fn create_file(&mut self) -> Result<(u64, BufWriter<File>)>
pub fn create_file(&mut self) -> Result<(u64, BufWriter<File>)>
2026-09-25: Create the next swap file; returns its id and a buffered writer.
Sourcepub fn open_file(&self, id: u64) -> Result<BufReader<File>>
pub fn open_file(&self, id: u64) -> Result<BufReader<File>>
2026-09-25: Open swap file id for buffered reading.
Sourcepub fn remove_file(&mut self, id: u64) -> Result<()>
pub fn remove_file(&mut self, id: u64) -> Result<()>
2026-09-25: Delete swap file id and subtract its size from the
recorded usage.
Sourcepub fn record_usage(&mut self, id: u64)
pub fn record_usage(&mut self, id: u64)
2026-09-25: Add file id’s current size to the recorded usage. Call
it once, after the writer is flushed; a missing file adds nothing.
Sourcepub fn has_space(&self, estimated_bytes: u64) -> bool
pub fn has_space(&self, estimated_bytes: u64) -> bool
2026-09-25: Whether estimated_bytes more would stay within the budget.
Sourcepub fn used_bytes(&self) -> u64
pub fn used_bytes(&self) -> u64
2026-09-25: Recorded usage in bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KvSpillManager
impl RefUnwindSafe for KvSpillManager
impl Send for KvSpillManager
impl Sync for KvSpillManager
impl Unpin for KvSpillManager
impl UnwindSafe for KvSpillManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more