1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
//! # fsys
//!
//! Adaptive file and directory IO for Rust — fast, hardware-aware, multi-strategy.
//!
//! `fsys` is a low-level filesystem abstraction designed for storage engines,
//! databases, and any application that needs predictable, high-performance
//! file IO with explicit control over durability strategy.
//!
//! ## What ships in `0.4.0`
//!
//! Adds the dual-pipeline model on top of the `0.3.0` foundation:
//!
//! - [`Handle::write_batch`], [`Handle::delete_batch`],
//! [`Handle::copy_batch`], and [`Handle::batch`]: the group-lane
//! batch API. Routes through a per-handle dispatcher thread that is
//! spawned lazily on first use and shut down cleanly on `Handle`
//! drop. Hybrid time-or-count window (default 1 ms / 128 ops),
//! bounded queue (default 1024) with blocking submission.
//! - [`Batch`]: a chainable builder for very large or dynamic batches.
//! - [`BatchError`]: per-batch failure reporting with `failed_at` /
//! `completed` / `source`.
//! - [`Error::ShutdownInProgress`] (FS-00009) and reserved
//! [`Error::QueueFull`] (FS-00010, never emitted in 0.4.0).
//!
//! Solo-lane ops (`write`, `read`, `append`, etc.) are byte-for-byte
//! identical to `0.3.0` — the pipeline is invisible on that path.
//!
//! ## What shipped in `0.3.0`
//!
//! - [`Error`] enum and [`Result`] type alias.
//! - [`Handle`]: the primary IO entry point — holds method, root, sector size.
//! - [`Builder`]: fluent builder for constructing a `Handle`.
//! - [`Method`]: durability strategy enum — `Sync`, `Data`, `Direct`, `Auto`.
//! - [`FileMeta`], [`DirEntry`], [`Permissions`]: filesystem metadata types.
//! - [`crud`]: file and directory CRUD as `impl Handle`.
//! - [`quick`]: convenience free functions backed by a default `Handle`.
//! - [`os`] module: OS detection.
//! - [`hardware`] module: hardware probe stubs.
//! - [`path`] module: per-OS path defaults and `Mode`.
//!
//! ## Quick start
//!
//! ```no_run
//! # fn example() -> fsys::Result<()> {
//! // One-shot write/read (uses a lazily-initialised default Handle):
//! fsys::quick::write("/tmp/hello.txt", b"hello")?;
//! let data = fsys::quick::read("/tmp/hello.txt")?;
//!
//! // Explicit Handle with a specific method:
//! let h = fsys::builder().method(fsys::Method::Data).build()?;
//! h.write("/tmp/world.txt", b"world")?;
//! # Ok(())
//! # }
//! ```
//!
//! ### Batch operations (0.4.0)
//!
//! Multiple ops share a single dispatcher round-trip and one durability
//! pass per modified file. The dispatcher thread is spawned lazily on
//! the first batch op and shut down cleanly on `Handle` drop.
//!
//! ```no_run
//! # fn example() {
//! let h = fsys::new().expect("handle");
//!
//! // Slice-based batch — best when ops are already collected.
//! h.write_batch(&[
//! ("/tmp/a.bin", b"alpha".as_slice()),
//! ("/tmp/b.bin", b"beta".as_slice()),
//! ])
//! .expect("batch");
//!
//! // Builder-based batch — best for large or dynamic batches.
//! let mut batch = h.batch();
//! let _ = batch.write("/tmp/c.bin", b"gamma");
//! let _ = batch.delete("/tmp/stale.tmp");
//! batch.commit().expect("commit");
//! # }
//! ```
//!
//! ## Goals
//!
//! - **Hardware-aware.** Detect drive type (NVMe, SSD, HDD) and capabilities
//! at startup. Pick sensible defaults.
//! - **Multi-strategy durability.** Support `fsync`, `fdatasync`, Direct IO.
//! - **Cross-platform.** Linux, macOS, Windows. Best path on each.
//! - **Zero magic.** Every strategy is explicit. No hidden buffering.
pub
pub
pub use crateBatch;
pub use crateBuilder;
pub use crate;
pub use crateHandle;
pub use crate;
pub use crateMethod;
pub use crateMode;
/// Creates a default [`Handle`] using [`Method::Auto`] and no root scope.
///
/// Equivalent to `Builder::new().build()`.
///
/// # Errors
///
/// Returns an error if method validation fails (this will not happen for
/// the default [`Method::Auto`] setting).
/// Creates a [`Handle`] using the specified [`Method`].
///
/// # Errors
///
/// Returns [`Error::UnsupportedMethod`] if a reserved method variant is
/// supplied.
/// Returns a new [`Builder`] with default settings.
///
/// # Example
///
/// ```
/// # fn example() -> fsys::Result<()> {
/// let handle = fsys::builder().method(fsys::Method::Sync).build()?;
/// # Ok(())
/// # }
/// ```
/// Library version, matching the crate version declared in `Cargo.toml`.
pub const VERSION: &str = env!;