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 7
File operation configuration.
size_t bufferSizeBuffer size hint for I/O operations.Callback invoked when a read operation completes.
Callback invoked when a write operation completes.
Callback invoked on error conditions.
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.
private AsyncFileState _stateAsyncFile 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.OpenResult open(ref EventLoop loop, scope const(char)[] path, int flags) @trustedOpen a file asynchronously.FileResult write(scope const(ubyte)[] data, ulong offset) @trustedWrite data to the file at the given offset.AsyncFileState mutableState() @trustedFileConfig _configHANDLE _handleFileState _fileStateEventLoop * _loopReadCallback onReadWriteCallback onWriteErrorCallback onErrorOVERLAPPED _readOverlappedOVERLAPPED _writeOverlappedubyte[] _readBufferubyte[] _writeBufferOperationType _pendingOpbool _appendModevoid fileCompletionCallback(void * context, OVERLAPPED * overlappedPtr,
size_t bytesTransferred, DWORD error) static @trusted nothrowStatic IOCP completion callback.void processReadCompletionData(DWORD bytesRead, DWORD error) @trusted nothrowProcess a completed read operation using IOCP completion data.void processWriteCompletionData(DWORD bytesWritten, DWORD error) @trusted nothrowProcess a completed write operation using IOCP completion data.this(FileConfig config)Functions 4
int mapWinError(DWORD winError) @safe nothrow @nogcMap Windows error codes to POSIX errno equivalents.OpenResult mapOpenError(DWORD winError) pure @safe nothrow @nogcMap Windows error codes to OpenResult variants.Variables 11
FILE_SHARE_READ = 0x00000001Windows file share mode.
FILE_SHARE_WRITE = 0x00000002FILE_ATTRIBUTE_NORMAL = 0x00000080FILE_FLAG_OVERLAPPED = 0x40000000O_RDONLY = 0x0000POSIX-like flags for compatibility. Open file read-only.
O_WRONLY = 0x0001Open file write-only.
O_RDWR = 0x0002Open file for reading and writing.
O_CREAT = 0x0100Create file if it does not exist.
O_TRUNC = 0x0200Truncate file to zero length.
O_APPEND = 0x0400Append on each write.
int _errnoThread-local errno for Windows compatibility.