Home / Class/ IoUringDomainSocketChannel Class — netty Architecture

IoUringDomainSocketChannel Class — netty Architecture

Architecture documentation for the IoUringDomainSocketChannel class in IoUringDomainSocketChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  821304c1_c5e6_ce98_158c_74866564555a["IoUringDomainSocketChannel"]
  57b307f7_744f_b12e_e6a9_8b981cc360b3["IoUringDomainSocketChannel.java"]
  821304c1_c5e6_ce98_158c_74866564555a -->|defined in| 57b307f7_744f_b12e_e6a9_8b981cc360b3
  aa4e119e_9bd7_be25_7c4e_3b1459d59603["IoUringDomainSocketChannel()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| aa4e119e_9bd7_be25_7c4e_3b1459d59603
  44124fb2_2931_798b_0eee_093e34fdfde5["DomainSocketChannelConfig()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| 44124fb2_2931_798b_0eee_093e34fdfde5
  ce52b674_6343_de70_587d_6565c21e39f6["DomainSocketAddress()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| ce52b674_6343_de70_587d_6565c21e39f6
  e32926b7_0082_520b_a368_90cfa5e96cba["PeerCredentials()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| e32926b7_0082_520b_a368_90cfa5e96cba
  bf8f5e24_6db0_d210_df72_8e91142052f3["Object()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| bf8f5e24_6db0_d210_df72_8e91142052f3
  92b5bd6c_6a60_7556_dca3_34ad0a390962["AbstractUringUnsafe()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| 92b5bd6c_6a60_7556_dca3_34ad0a390962
  cad5cdd2_c65a_ba0c_5fec_fb0e1325bdfc["allowMultiShotPollIn()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| cad5cdd2_c65a_ba0c_5fec_fb0e1325bdfc
  642ddedb_d731_5454_59a4_9d60955f60d0["isPollInFirst()"]
  821304c1_c5e6_ce98_158c_74866564555a -->|method| 642ddedb_d731_5454_59a4_9d60955f60d0

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDomainSocketChannel.java lines 39–267

public final class IoUringDomainSocketChannel extends AbstractIoUringStreamChannel implements DomainSocketChannel {

    private final IoUringDomainSocketChannelConfig config;

    private volatile DomainSocketAddress local;
    private volatile DomainSocketAddress remote;

    public IoUringDomainSocketChannel() {
        super(null, LinuxSocket.newSocketDomain(), false);
        config = new IoUringDomainSocketChannelConfig(this);
    }

    IoUringDomainSocketChannel(Channel parent, FileDescriptor fd) {
        this(parent, new LinuxSocket(fd.intValue()));
    }

    IoUringDomainSocketChannel(Channel parent, LinuxSocket fd) {
        super(parent, fd, true);
        local = fd.localDomainSocketAddress();
        remote = fd.remoteDomainSocketAddress();
        config = new IoUringDomainSocketChannelConfig(this);
    }

    @Override
    public DomainSocketChannelConfig config() {
        return config;
    }

    @Override
    public DomainSocketAddress localAddress() {
        return local;
    }

    @Override
    public DomainSocketAddress remoteAddress() {
        return remote;
    }

    /**
     * Returns the unix credentials (uid, gid, pid) of the peer
     * <a href=https://man7.org/linux/man-pages/man7/socket.7.html>SO_PEERCRED</a>
     */
    public PeerCredentials peerCredentials() throws IOException {
        return socket.getPeerCredentials();
    }

    @Override
    protected Object filterOutboundMessage(Object msg) {
        if (msg instanceof FileDescriptor) {
            return msg;
        }
        return super.filterOutboundMessage(msg);
    }

    @Override
    protected AbstractUringUnsafe newUnsafe() {
        return new IoUringDomainSocketUnsafe();
    }

    @Override
    protected boolean allowMultiShotPollIn() {
        // UNIX domain sockets do not support IORING_CQE_F_SOCK_NONEMPTY and POLL_ADD_MULTI is edge-triggered
        // so we should disable it
        return false;
    }

    private final class IoUringDomainSocketUnsafe extends IoUringStreamUnsafe {

        private MsgHdrMemory writeMsgHdrMemory;
        private MsgHdrMemory readMsgHdrMemory;

        @Override
        protected int scheduleWriteSingle(Object msg) {
            if (msg instanceof FileDescriptor) {
                // we can reuse the same memory for any fd
                // because we never have more than a single outstanding write.
                if (writeMsgHdrMemory == null) {
                    writeMsgHdrMemory = new MsgHdrMemory();
                }
                IoRegistration registration = registration();
                IoUringIoOps ioUringIoOps = prepSendFdIoOps((FileDescriptor) msg, writeMsgHdrMemory);

Frequently Asked Questions

What is the IoUringDomainSocketChannel class?
IoUringDomainSocketChannel is a class in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDomainSocketChannel.java.
Where is IoUringDomainSocketChannel defined?
IoUringDomainSocketChannel is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDomainSocketChannel.java at line 39.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free