Expand description
§store-io-win
The Windows backend behind the store-io-platform traits.
- Data handles are opened
FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPEDwith read, write and delete sharing; exclusivity comes from the ownership lock (WinLock), never from share modes. WinQueuesubmits overlappedWriteFile/ReadFileand reaps from its own I/O completion port withGetQueuedCompletionStatusEx, waitingINFINITEor polling with a zero timeout. No wait anywhere in this crate has a finite non-zero timeout.- A data flush is
NtFlushBuffersFileEx(FLUSH_FLAGS_FILE_DATA_SYNC_ONLY)on NTFS andFlushFileBufferselsewhere; the choice is made once at open and recorded on the handle (WinFile::flush_mode). - A
dsyncwrite performs the write and then that same data flush before it completes, so “durable at completion” never depends onFILE_FLAG_WRITE_THROUGH, whose FUA path is not certified on Windows. - Rename replaces by handle with
FileRenameInfoEx(REPLACE_IF_EXISTS | POSIX_SEMANTICS); delete usesFileDispositionInfoEx(DELETE | POSIX_SEMANTICS). Legacy fallbacks are recorded, never silent. Platform::probefillsEvidencefrom the volume, the file, the physical drive’s storage properties and, on NVMe, the controller and namespace identify data, the write-cache feature and the health log. Device output is parsed as untrusted bytes with bounds checks.
Every unsafe block cites the Win32 contract it relies on. All of them
live in the private sys module except the two calls in the queue that
hand a buffer and its completion record to WriteFile / ReadFile,
whose lifetime contract the queue’s slot table upholds. On a non-Windows
target the crate compiles to an empty shell: none of the types below
exist there.
Structs§
- WinDir
- An open directory (
FILE_FLAG_BACKUP_SEMANTICS, add-file access soFlushFileBuffersis accepted). - WinFile
- An open data file (closed when the last handle to it, including a held
crate::WinLock, is dropped). - WinLock
- A held ownership lock, released by
UnlockFileExon drop. It keeps the file handle alive, so the lock is always released before the handle closes. - WinPlatform
- The Windows backend. Stateless: every handle it opens carries its own facts (flush mode, access), and every queue owns its own completion port.
- WinQueue
- A per-thread IOCP submission queue (see the module docs).
- WinWaker
- Ends a
WinQueue’s wait from another thread (D-083): a packet with noOVERLAPPEDposted to the queue’s port, at most one at a time. If the kernel refuses the post (out of non-paged memory), the next wake tries again; until then the waiter returns at its next completion.
Enums§
- Flush
Mode - Which primitive a data flush uses on this file, chosen once at open from the filesystem and never weakened afterwards.