irontide_core/storage_mode.rs
1use serde::{Deserialize, Serialize};
2
3/// How torrent files are allocated on disk.
4///
5/// Matches libtorrent's `storage_mode_t`.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
7pub enum StorageMode {
8 /// Auto-select: mmap on 64-bit, pread/pwrite on 32-bit.
9 #[default]
10 Auto,
11 /// Sparse file allocation (`set_len`, no pre-allocation).
12 Sparse,
13 /// Full pre-allocation (fallocate / write zeros).
14 Full,
15 /// Memory-mapped file I/O (64-bit recommended).
16 Mmap,
17 /// `io_uring` kernel-bypass I/O (Linux 5.6+).
18 /// Falls back to standard I/O when `io_uring` is unavailable.
19 IoUring,
20 /// IOCP kernel async I/O (Windows).
21 /// Falls back to standard I/O when IOCP is unavailable.
22 Iocp,
23}