eve.aio.posix.unix
Async Unix domain socket listener and connection primitives for POSIX platforms.
This module provides the POSIX implementation of Unix domain socket primitives using standard BSD sockets API. Unix domain sockets provide inter-process communication on the same host without network overhead.
Types 13
Connection-side buffer configuration.
size_t highWaterMarkMaximum queued bytes before `send` starts reporting pressure.size_t lowWaterMarkQueue threshold below which `onWritable` may fire again.Listener-side socket configuration.
int backlogPending accept backlog passed to `listen(2)`.Async Unix domain socket connection wrapper.
Wraps a non-blocking Unix domain socket and integrates with the Layer 1 event loop for async read/write operations with backpressure support.
UnixConnectionState _stateUnixConnection create(UnixConnectionConfig config = UnixConnectionConfig.init) @trusted nothrowCreate a detached connection wrapper.bool isOpen() @property const @safe nothrow @nogcReport whether the wrapper currently owns an open socket.bool isWritable() @property const @safe nothrow @nogcReport whether the connection is currently writable from the caller's perspective.AdoptResult adopt(ref EventLoop loop, Handle clientHandle) @trusted nothrowAdopt an already-accepted client socket.ConnectResult connect(ref EventLoop loop, scope const(char)[] path, CancelToken cancel = CancelToken.invalid) @trustedStart a non-blocking connection attempt to a Unix domain socket path.bool track(Coord)(ref Coord coordinator) @trusted nothrowTrack this connection for graceful shutdown.Async Unix domain socket listener wrapper.
Wraps a non-blocking Unix domain socket listening socket and integrates with the Layer 1 event loop for async accept operations.
UnixListenerState _stateUnixListener create(UnixListenerConfig config = UnixListenerConfig.init) @trustedCreate a detached listener wrapper.void onConnection(ConnectionCallback callback) @property @trustedSet the high-level connection callback.bool isOpen() @property const @safe nothrow @nogcReport whether the listener currently owns an open socket.const(char)[] localPath() @property const @safe nothrow @nogcReport the filesystem path the listener is bound to.ListenResult listen(ref EventLoop loop, scope const(char)[] path) @trustedStart listening on the requested Unix domain socket path.ConnectCallback onConnectDataCallback onDataWritableCallback onWritableCloseCallback onCloseErrorCallback onErrorEventLoop * _loopHandle _handleToken _tokenUnixConnectionConfig _configbool _readingPausedbool _watchingWritebool _awaitingWritablebool _closeDeliveredubyte[] _sendQueueSocketState _stateCancelToken _cancelTokenCancelToken _shutdownTokenbool _drainingConnectResult connect(ref EventLoop loop, scope const(char)[] path, CancelToken cancel = CancelToken.invalid) @trusted nothrowSendResult send(scope const(ubyte)[] data) @trustedthis(UnixConnectionConfig config)AcceptCallback onAcceptConnectionCallback onConnectionEventLoop * _loopHandle _handleToken _tokenUnixListenerConfig _configbyte[UNIX_PATH_MAX] _localPathCancelToken _shutdownTokenbool _drainingthis(UnixListenerConfig config)Functions 9
UnixConnectionConfig validated(UnixConnectionConfig config) pure @safe nothrow @nogcValidate a connection config, returning defaults if invalid.UnixListenerConfig validated(UnixListenerConfig config) pure @safe nothrow @nogcValidate a listener config, returning defaults if invalid.bool wouldBlock(int value) pure @safe nothrow @nogcCheck if an errno value indicates the operation would block.bool isValidPath(scope const(char)[] path) pure @safe nothrow @nogcCheck if a Unix socket path is valid.Variables 1
UNIX_PATH_MAX = sockaddr_un.init.sun_path.lengthMaximum length of a Unix domain socket path.
This is typically 108 bytes on Linux and 104 on BSD/macOS, but we use the actual sun_path array size for correctness.