eve.aio.result

Consolidated Result Enums for EVE AIO Operations.

This module provides all result, state, and close reason enums used across EVE's async I/O subsystem. By centralizing these definitions, we avoid duplicate enum definitions and naming conflicts when importing multiple AIO modules.

The enums are designed to be:

  • Portable — same values on all platforms (Linux, Windows, BSD, macOS)
  • Type-safe — compiler-checked with final switch
  • Self-documenting — named variants instead of magic numbers
  • Minimal overhead — all are ubyte (1 byte)

Example:

final switch (listener.listen(loop, "0.0.0.0", 8080)) {
    case ListenResult.OK:
        loop.run();
        break;
    case ListenResult.ADDRESS_IN_USE:
        writeln("Port already in use");
        break;
    // ... compiler ensures all cases handled
}

Types 14

enumSendResult : ubyte

Result of stream send operations (TCP, Unix, Pipe).

Used by TcpConnection.send(), UnixConnection.send(), and Pipe.write().

Retryability and Fatality Guide:

  • OK — Success, no retry needed
  • PARTIAL — Retryable, call again with remaining data
  • PRESSURE — Retryable, wait for onWritable callback before retry
  • CLOSED — Fatal, connection cannot be reused
  • ERROR — Depends on errno/GetLastError; may be retryable or fatal

OKData was sent successfully. Retryable: No (operation completed) Fatal: No
PARTIALPartial data was sent; retry with remainder. Retryable: Yes (immediately, with remaining data) Fatal: No
PRESSURESend buffer is full; wait for onWritable callback. Retryable: Yes (after waiting for backpressure to clear) Fatal: No Action: Register for onWritable callback before retrying
CLOSEDConnection has been closed. Retryable: No Fatal: Yes (connection cannot be reused)
ERRORAn error occurred. Retryable: Depends on errno (check EINTR, EAGAIN) Fatal: Depends on error code Action: Check errno/GetLastError for details
enumDatagramResult : ubyte

Result of datagram send operations (UDP).

Used by UdpSocket.sendTo(). This is separate from SendResult because UDP has different semantics — datagrams are atomic, so there's no PARTIAL.

Retryability and Fatality Guide:

  • OK — Success, datagram queued for transmission
  • NOT_READY — Retryable after socket is bound
  • WOULD_BLOCK — Retryable immediately or after brief delay
  • ERROR — Depends on errno; may be retryable or fatal

OKDatagram was sent successfully. Retryable: No (operation completed) Fatal: No
NOT_READYSocket is not bound or not ready. Retryable: Yes (after binding the socket) Fatal: No
WOULD_BLOCKSend would block; retry later. Retryable: Yes (immediately or after brief delay) Fatal: No Note: Unlike stream PRESSURE, this is immediate blocking, not backpressure
ERRORAn error occurred. Retryable: Depends on errno (check EINTR, EMSGSIZE) Fatal: Depends on error code Action: Check errno/GetLastError for details
enumFileResult : ubyte

Result of file read/write operations.

Used by AsyncFile.read() and AsyncFile.write().

Retryability and Fatality Guide:

  • OK — Operation completed synchronously
  • PENDING — Not an error; wait for callback
  • ERROR — Depends on errno; may be retryable
  • CLOSED — Fatal, file cannot be reused

OKOperation completed successfully. Retryable: No (operation completed) Fatal: No
PENDINGOperation is pending; callback will fire on completion. Retryable: No (wait for completion callback instead) Fatal: No Note: This is not an error; async operation is in progress
ERRORAn error occurred. Retryable: Depends on errno (check EINTR, EIO) Fatal: Depends on error code Action: Check errno/GetLastError for details
CLOSEDFile has been closed. Retryable: No Fatal: Yes (file handle cannot be reused)
enumListenResult : ubyte

Result of listen/bind operations.

Used by TcpListener.listen(), UnixListener.listen(), and UdpSocket.bind().

Retryability and Fatality Guide:

  • OK — Success, socket is listening/bound
  • INVALID_ARGUMENT — Fatal, fix arguments
  • ADDRESS_IN_USE — Retryable after port is freed or use different port
  • PERMISSION_DENIED — Fatal, requires elevated privileges or different port
  • ADDRESS_NOT_AVAILABLE — Fatal, address cannot be bound on this host
  • RESOURCE_LIMIT — Retryable after resources are freed
  • ERROR — Depends on errno

OKServer is now listening. Retryable: No (operation completed) Fatal: No
INVALID_ARGUMENTInvalid host, port, or path argument. Retryable: No Fatal: Yes (requires code fix)
ADDRESS_IN_USEAddress or port is already in use. Retryable: Yes (after port is freed or with different port) Fatal: No Action: Wait for other process to release port, or choose different port
PERMISSION_DENIEDPermission denied (e.g., port < 1024 requires root). Retryable: No Fatal: Yes (requires elevated privileges or different port)
ADDRESS_NOT_AVAILABLERequested address is not available on this host. Retryable: No Fatal: Yes Action: Verify network interface configuration
RESOURCE_LIMITSystem resource limit reached (e.g., file descriptors). Retryable: Maybe (after freeing resources) Fatal: No Action: Close unused file descriptors or increase system limits
ERRORUnspecified error. Retryable: Depends on errno Fatal: Depends on error code Action: Check errno/GetLastError for details
enumConnectResult : ubyte

Result of connect operations.

Used by TcpConnection.connect() and UnixConnection.connect().

Retryability and Fatality Guide:

  • OK — Success, connection initiated
  • INVALID_ARGUMENT — Fatal, fix arguments
  • CONNECTION_REFUSED — Retryable with exponential backoff
  • NETWORK_UNREACHABLE — Retryable after network is restored
  • HOST_UNREACHABLE — Retryable with backoff
  • TIMED_OUT — Retryable with longer timeout
  • RESOURCE_LIMIT — Retryable after freeing resources
  • ERROR — Depends on errno

OKConnection initiated (async; wait for onConnect callback). Retryable: No (operation completed) Fatal: No
INVALID_ARGUMENTInvalid host, port, or path argument. Retryable: No Fatal: Yes (requires code fix)
CONNECTION_REFUSEDConnection refused by remote host. Retryable: Yes (with exponential backoff) Fatal: No Action: Verify remote service is running and retry with backoff
NETWORK_UNREACHABLENetwork is unreachable. Retryable: Yes (after network connectivity is restored) Fatal: No Action: Check network configuration and connectivity
HOST_UNREACHABLEHost is unreachable. Retryable: Yes (with exponential backoff) Fatal: No Action: Verify host is online and network path exists
TIMED_OUTConnection attempt timed out. Retryable: Yes (with longer timeout or after backoff) Fatal: No
RESOURCE_LIMITSystem resource limit reached. Retryable: Maybe (after freeing resources) Fatal: No Action: Close unused connections or increase system limits
ERRORUnspecified error. Retryable: Depends on errno Fatal: Depends on error code Action: Check errno/GetLastError for details
enumAdoptResult : ubyte

Result of handle adoption operations.

Used by TcpConnection.adopt() and UnixConnection.adopt().

Retryability and Fatality Guide:

  • OK — Success, handle adopted
  • INVALID_HANDLE — Fatal, handle is invalid
  • REGISTRATION_FAILED — Retryable after freeing event loop resources
  • RESOURCE_LIMIT — Retryable after freeing resources
  • ERROR — Depends on errno

OKHandle was successfully adopted. Retryable: No (operation completed) Fatal: No
INVALID_HANDLEInvalid handle provided. Retryable: No Fatal: Yes (requires valid handle)
REGISTRATION_FAILEDFailed to register with event loop. Retryable: Maybe (after freeing event loop resources) Fatal: No Action: Verify event loop has capacity for new handles
RESOURCE_LIMITSystem resource limit reached. Retryable: Maybe (after freeing resources) Fatal: No Action: Close unused file descriptors or increase system limits
ERRORUnspecified error. Retryable: Depends on errno Fatal: Depends on error code Action: Check errno/GetLastError for details
enumOpenResult : ubyte

Result of file open operations.

Used by AsyncFile.open().

Retryability and Fatality Guide:

  • OK — Success, file opened
  • INVALID_ARGUMENT — Fatal, fix arguments
  • NOT_FOUND — Fatal for read, retryable for write with O_CREAT
  • PERMISSION_DENIED — Fatal, requires permission changes
  • IS_DIRECTORY — Fatal, path points to directory
  • TOO_MANY_FILES — Retryable after closing files
  • ERROR — Depends on errno

OKFile was opened successfully. Retryable: No (operation completed) Fatal: No
INVALID_ARGUMENTInvalid path or flags argument. Retryable: No Fatal: Yes (requires code fix)
NOT_FOUNDFile or directory not found. Retryable: No (unless creating with O_CREAT) Fatal: Usually yes Action: Verify file path exists
PERMISSION_DENIEDPermission denied. Retryable: No Fatal: Yes (requires filesystem permission changes)
IS_DIRECTORYPath is a directory, not a file. Retryable: No Fatal: Yes (requires different path)
TOO_MANY_FILESToo many open files in system. Retryable: Yes (after closing unused files) Fatal: No Action: Close unused file descriptors or increase system limits
ERRORUnspecified error. Retryable: Depends on errno Fatal: Depends on error code Action: Check errno/GetLastError for details
enumStartResult : ubyte

Result of console input start operation (Windows).

Used by ConsoleInput.start().

Retryability and Fatality Guide:

  • OK — Success, console input started
  • INVALID_STATE — Fatal, console already started or disposed
  • INVALID_HANDLE — Fatal, cannot get console handle
  • REGISTRATION_FAILED — Retryable after freeing event loop resources
  • ERROR — Depends on GetLastError

OKConsole input started successfully. Retryable: No (operation completed) Fatal: No
INVALID_STATEInvalid state (already started or disposed). Retryable: No Fatal: Yes (requires stopping console first)
INVALID_HANDLEFailed to get console handle. Retryable: No Fatal: Yes (console not available) Action: Verify application is running in console mode
REGISTRATION_FAILEDFailed to register with event loop. Retryable: Maybe (after freeing event loop resources) Fatal: No Action: Verify event loop has capacity for new handles
ERRORUnspecified error. Retryable: Depends on error code Fatal: Depends on error code Action: Check GetLastError for details
enumSocketState : ubyte

State of a socket (TCP or Unix).

Used by TcpConnection and UnixConnection.

INITInitial state, not yet connected.
CONNECTINGConnection in progress.
CONNECTEDConnected and ready for I/O.
CLOSEDConnection has been closed.
ERRORSocket is in an error state.
enumFileState : ubyte

State of an async file.

Used by AsyncFile.

INITInitial state, not yet opened.
OPENFile is open and ready for operations.
CLOSEDFile has been closed.
ERRORFile is in an error state.
enumPipeState : ubyte

State of a pipe endpoint.

Used by Pipe.

INITInitial state, not yet opened.
OPENPipe is open and ready for I/O.
CLOSEDPipe has been closed.
ERRORPipe is in an error state.
enumConsoleState : ubyte

State of console input (Windows).

Used by ConsoleInput.

INITInitial state, not yet started.
RUNNINGConsole is running and processing input.
STOPPEDConsole has been stopped.
ERRORConsole is in an error state.
enumSocketCloseReason : ubyte

Reason a socket was closed.

Used by TcpConnection and UnixConnection close callbacks.

EOFRemote end closed the connection gracefully.
RESETConnection was reset by remote end.
CLOSEDConnection was closed locally.
ERRORConnection was closed due to an error.
CANCELLEDConnection was cancelled.
enumPipeCloseReason : ubyte

Reason a pipe was closed.

Used by Pipe close callbacks.

EOFRemote end closed the pipe.
CLOSEDPipe was closed locally.
ERRORPipe was closed due to an error.