eve.aio.windows.io
Async file I/O primitives for Windows.
This module provides the Windows implementation of asynchronous file I/O using IOCP overlapped I/O. Files are opened with FILE_FLAG_OVERLAPPED and associated with the event loop's I/O completion port for true async operation.
Uses overlapped ReadFile() and WriteFile() with file offsets specified in the OVERLAPPED structure.
Types 2
structFileConfig
File operation configuration.
Fields
size_t bufferSizeBuffer size hint for I/O operations.Methods
structAsyncFile
Async file handle wrapper.
Wraps a file handle and integrates with the Layer 1 event loop for async read/write operations using IOCP overlapped I/O.
Methods
AsyncFile create(FileConfig config = FileConfig.init) static @trustedCreate a detached file wrapper.bool usingIocp() @property const @safe nothrow @nogcReport whether this file is using IOCP overlapped I/O.OpenStatus open(ref EventLoop loop, scope const(char)[] path, int flags) @trustedOpen a file asynchronously.FileIoResult read(ubyte[] buffer, ulong offset) @trustedRead data from the file at the given offset.FileIoResult write(scope const(ubyte)[] data, ulong offset) @trustedWrite data to the file at the given offset.Variables 6
enumvar
O_RDONLY = 0x0000POSIX-like flags for compatibility. Open file read-only.
enumvar
O_WRONLY = 0x0001Open file write-only.
enumvar
O_RDWR = 0x0002Open file for reading and writing.
enumvar
O_CREAT = 0x0100Create file if it does not exist.
enumvar
O_TRUNC = 0x0200Truncate file to zero length.
enumvar
O_APPEND = 0x0400Append on each write.