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

File operation configuration.

Fields
size_t bufferSizeBuffer size hint for I/O operations.
Methods
bool isValid() @property const pure @safe nothrow @nogcValidate the config.
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.
void onRead(ReadCallback callback) @safeRegister callback for read completion.
void onWrite(WriteCallback callback) @safeRegister callback for write completion.
void onError(ErrorCallback callback) @safeRegister callback for error conditions.
bool isOpen() @property const @safe nothrow @nogcReport whether the file is open.
bool usingIocp() @property const @safe nothrow @nogcReport whether this file is using IOCP overlapped I/O.
FileState state() @property const @safe nothrow @nogcReport the current file state.
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.
long size() @trustedGet the file size in bytes.
void close() @safe nothrowClose the file handle.
void dispose() @safe nothrowDispose of the file wrapper and release all resources.

Variables 6

enumvarO_RDONLY = 0x0000

POSIX-like flags for compatibility. Open file read-only.

enumvarO_WRONLY = 0x0001

Open file write-only.

enumvarO_RDWR = 0x0002

Open file for reading and writing.

enumvarO_CREAT = 0x0100

Create file if it does not exist.

enumvarO_TRUNC = 0x0200

Truncate file to zero length.

enumvarO_APPEND = 0x0400

Append on each write.