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 12

structHandle

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.

Fields
NativeHandle value
Handle(INVALID_NATIVE_HANDLE) invalidSentinel handle used when a registration has no valid native handle.
Methods
Handle fromNative(NativeHandle value) pure @safe nothrow @nogcWrap a native OS handle.
bool isValid() @property const pure @safe nothrow @nogcCheck whether the wrapped handle is valid for the current platform.
enumAddressFamily : ubyte

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.

UNSPEC
IPV4
IPV6
UNIX
structIpAddress

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.

Fields
Methods
bool isValid() @property const pure @safe nothrow @nogcCheck whether the address is valid (not unspecified).
string toString() const @safeConvert the IP address to its standard string representation.
enumDnsError : int

Common DNS resolution errors.

NONE = 0
BAD_FLAGS = 1
NONAME = 2
AGAIN = 3
FAIL = 4
FAMILY = 5
MEMORY = 6
SYSTEM = 7
OVERFLOW = 8
CANCELLED = 9
enumLimitAction : ubyte

Action taken when an EventLoop resource limit is hit.

rejectReturn an error or refuse registration (default).
dropOldestDrop the oldest compatible watcher/connection to make room.
callbackInvoke a user-provided callback to decide.
enumLimitKind : ubyte

Types of resource limits tracked by an EventLoop.

watchersMaximum number of total watchers (I/O, timers, signals, etc.).
sendQueueMaximum total bytes buffered in all TCP send queues.
timersMaximum number of active timers.
fileDescriptorsMaximum number of open file descriptors.
connectionsMaximum number of active TCP/Unix connections.

Resource limits configuration for an EventLoop.

Fields
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.

Fields
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.
enumSignal : ubyte

Normalized signal values that higher layers may care about.

INTERRUPT
TERMINATE
HANGUP
CHILD
USER1
USER2
WINCHWindow size change (POSIX only).

Requested I/O interests.

Instances behave like a small bit-mask value that can be combined with `|` and tested with contains.

Fields
ushort bits
IoInterest(0) noneNo readiness requested.
IoInterest(1 << 0) readableReadability requested.
IoInterest(1 << 1) writableWritability requested.
IoInterest(1 << 2) priorityExceptional or priority data requested.
IoInterest(1 << 3) errorError notifications requested.
IoInterest(1 << 4) hangupHangup notifications requested.
Methods
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.
bool opCast(T : bool)() const pure @safe nothrow @nogcConvert the interest mask to a boolean.
structIoReady

Actual readiness reported by the OS backend.

Fields
ushort bits
IoReady(0) noneNo readiness reported.
IoReady(1 << 0) readableReadability reported.
IoReady(1 << 1) writableWritability reported.
IoReady(1 << 2) priorityExceptional or priority data reported.
IoReady(1 << 3) errorError state reported.
IoReady(1 << 4) hangupHangup or peer shutdown reported.
Methods
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.
bool opCast(T : bool)() const pure @safe nothrow @nogcConvert the readiness mask to a boolean.
structOsEvent

Shared event payload emitted by Layer 0 backends.

Fields
ulong userDataOpaque user value attached during backend registration.
IoReady readyNormalized readiness flags translated from the native backend event.