mmap_io/flush.rs
1#![allow(dead_code)]
2//! Flush policy configuration for MemoryMappedFile.
3//!
4//! Controls when writes to a RW mapping should be flushed to disk.
5
6/// Policy controlling when to flush dirty pages to disk.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
8pub enum FlushPolicy {
9 /// Never flush implicitly; flush() must be called by the user.
10 #[default]
11 Never,
12 /// Alias of Never for semantic clarity when using the builder API.
13 Manual,
14 /// Flush after every write/update_region call.
15 Always,
16 /// Flush when at least N bytes have been written since the last flush.
17 EveryBytes(usize),
18 /// Flush after every W writes (calls to update_region).
19 EveryWrites(usize),
20 /// Reserved for future time-based flushing (no-op for now).
21 EveryMillis(u64),
22}
23