eve.backend.common
Shared Layer 0 types used by all OS backends.
This module keeps the vocabulary between platform pollers small and explicit so higher layers can talk about handles, interests, readiness, and translated events without depending on OS-specific constants.
Types 14
Identifies the active Layer 0 backend implementation.
This enum allows higher layers and users to determine which backend is actually being used at runtime, which is important because:
- Linux may fall back from io_uring to epoll if io_uring setup fails
- Windows may fall back from IOCP to WSAPoll
- Different backends have different performance characteristics
Example:
auto loop = EventLoop.create();
writeln("Using backend: ", loop.backendId);
if (loop.backendId == BackendId.IO_URING) {
writeln("io_uring is active - optimal performance");
}Capability flags reported by a Layer 0 backend.
These flags help higher layers and users understand what features are available on the current platform/backend combination.
bool supportsIoWatchBackend can watch file descriptors/handles for readiness.bool supportsNativeTimersBackend can handle timers natively (vs. emulation).bool supportsSignalsBackend can receive OS signals.bool supportsCrossThreadWakeupBackend supports cross-thread wakeup notifications.bool supportsUnixSocketsBackend supports Unix domain sockets (POSIX only).bool supportsAsyncFilesBackend supports async file I/O without thread pool.bool supportsHighResTimersBackend supports high-resolution timers (< 1ms).bool supportsSqpollBackend supports SQPOLL mode (kernel-side submission polling).bool supportsFixedBuffersBackend supports zero-copy I/O via registered fixed buffers.bool supportsSpliceBackend supports splice/sendfile operations.uint maxHandleHintApproximate maximum file descriptors/handles (0 = unknown/unlimited).bool isFallbackThe backend fell back from a preferred implementation.int fallbackReasonError code from failed preferred backend setup (0 = no error).Lightweight wrapper around the backend's native handle type.
The wrapper does not own the handle lifetime. It exists so higher layers can avoid passing raw OS primitives directly.
NativeHandle value invalidSentinel handle used when a registration has no valid native handle.bool isValid() @property const pure @safe nothrow @nogcCheck whether the wrapped handle is valid for the current platform.Address families for networking.
This enum is used instead of Phobos' std.socket.AddressFamily to remain strictly @nogc and to keep the vocabulary between OS backends normalized and small.
Representation of an IP address.
This struct is used instead of Phobos' std.socket.Address classes to ensure zero-allocation performance and to allow embedding directly into WatcherSlot unions.
AddressFamily familyCommon DNS resolution errors.
These error codes correspond to standard DNS resolution failures that may occur during hostname lookup operations.
Retryability and Fatality Guide:
OK— Success, no retry neededBAD_FLAGS— Fatal, invalid flags passed to resolverNONAME— Fatal, hostname does not existAGAIN— Retryable, temporary resolver failureFAIL— Maybe retryable, depends on DNS server stateFAMILY— Fatal, address family not supportedMEMORY— Maybe retryable, out of memorySYSTEM— Maybe retryable, system-level error occurredOVERFLOW— Fatal, result buffer too smallCANCELLED— Fatal, operation was cancelled by user
Action taken when an EventLoop resource limit is hit.
Types of resource limits tracked by an EventLoop.
Resource limits configuration for an EventLoop.
uint maxWatchersMaximum number of registered watchers. 0 = unlimited.size_t maxSendQueueBytesMaximum total bytes in TCP send queues. 0 = unlimited.uint maxTimersMaximum pending timer count. 0 = unlimited.uint maxFdsMaximum file descriptors to keep open. 0 = use system limit.uint maxConnectionsMaximum number of active connections. 0 = unlimited.LimitAction onLimitHitAction when a limit is hit.Snapshot of current resource usage in an EventLoop.
size_t watchersTotal number of active watchers.size_t sendQueueBytesTotal bytes buffered in all send queues.size_t timersTotal number of active timers.size_t activeConnectionsTotal number of active network connections.size_t fileDescriptorsEstimate of total open file descriptors managed by the loop.size_t iterationCountTotal number of completed loop iterations (runOnce turns).size_t wakeupCountTotal number of cross-thread wakeup notifications triggered.size_t errorCountTotal number of backend errors or silently ignored failures.size_t limitRejectionCountTotal number of registrations rejected due to a configured limit.Normalized signal values that higher layers may care about.
Requested I/O interests.
Instances behave like a small bit-mask value that can be combined with `|` and tested with contains.
ushort bits noneNo readiness requested. readableReadability requested. writableWritability requested. priorityExceptional or priority data requested. errorError notifications requested. hangupHangup notifications requested.bool contains(IoInterest other) const pure @safe nothrow @nogcCheck whether all bits from `other` are present.IoInterest opBinary(string op : "|")(IoInterest other) const pure @safe nothrow @nogcCombine two interest masks.IoInterest opBinary(string op : "&")(IoInterest other) const pure @safe nothrow @nogcIntersect two interest masks.IoInterest opBinary(string op : "^")(IoInterest other) const pure @safe nothrow @nogcToggle bits from another interest mask.void opOpAssign(string op : "|")(IoInterest other) pure @safe nothrow @nogcAdd interest bits in place.void opOpAssign(string op : "&")(IoInterest other) pure @safe nothrow @nogcKeep only intersecting interest bits in place.void opOpAssign(string op : "^")(IoInterest other) pure @safe nothrow @nogcToggle interest bits in place.Actual readiness reported by the OS backend.
ushort bits noneNo readiness reported. readableReadability reported. writableWritability reported. priorityExceptional or priority data reported. errorError state reported. hangupHangup or peer shutdown reported.bool contains(IoReady other) const pure @safe nothrow @nogcCheck whether all bits from `other` are present.IoReady opBinary(string op : "|")(IoReady other) const pure @safe nothrow @nogcCombine two readiness masks.IoReady opBinary(string op : "&")(IoReady other) const pure @safe nothrow @nogcIntersect two readiness masks.IoReady opBinary(string op : "^")(IoReady other) const pure @safe nothrow @nogcToggle bits from another readiness mask.void opOpAssign(string op : "|")(IoReady other) pure @safe nothrow @nogcAdd readiness bits in place.void opOpAssign(string op : "&")(IoReady other) pure @safe nothrow @nogcKeep only intersecting readiness bits in place.void opOpAssign(string op : "^")(IoReady other) pure @safe nothrow @nogcToggle readiness bits in place.Functions 1
string backendName(BackendId id) pure @safe nothrow @nogcReturns a human-readable name for a backend.