Home / Class/ Builder Class — netty Architecture

Builder Class — netty Architecture

Architecture documentation for the Builder class in IoUringBufferRingConfig.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  11448346_fd97_747d_12dc_e15bd5d8e850["Builder"]
  1e575dd6_a424_21de_d460_00d77762f04c["IoUringBufferRingConfig.java"]
  11448346_fd97_747d_12dc_e15bd5d8e850 -->|defined in| 1e575dd6_a424_21de_d460_00d77762f04c
  123a2ecd_73f9_29ac_8273_cfc3d6b8cd82["Builder()"]
  11448346_fd97_747d_12dc_e15bd5d8e850 -->|method| 123a2ecd_73f9_29ac_8273_cfc3d6b8cd82
  fe409937_657b_fe15_0e6b_c8d880a81ad0["IoUringBufferRingConfig()"]
  11448346_fd97_747d_12dc_e15bd5d8e850 -->|method| fe409937_657b_fe15_0e6b_c8d880a81ad0

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringBufferRingConfig.java lines 187–273

    public static final class Builder {
        private short bgId = -1;
        private short bufferRingSize = -1;
        private int batchSize = -1;
        private boolean incremental = IoUring.isRegisterBufferRingIncSupported();
        private IoUringBufferRingAllocator allocator;
        private boolean batchAllocation;

        /**
         * Set the buffer group id to use.
         *
         * @param bgId  The buffer group id to use.
         * @return      This builder.
         */
        public Builder bufferGroupId(short bgId) {
            this.bgId = bgId;
            return this;
        }

        /**
         * Set the size of the ring.
         *
         * @param bufferRingSize    The size of the ring.
         * @return                  This builder.
         */
        public Builder bufferRingSize(short bufferRingSize) {
            this.bufferRingSize = bufferRingSize;
            return this;
        }

        /**
         * Set the size of the batch on how many buffers are added everytime we need to expand the buffer ring.
         *
         * @param batchSize The batch size.
         * @return          This builder.
         */
        public Builder batchSize(int batchSize) {
            this.batchSize = batchSize;
            return this;
        }

        /**
         * Set the {@link IoUringBufferRingAllocator} to use to allocate {@link ByteBuf}s.
         *
         * @param allocator         The allocator.
         */
        public Builder allocator(IoUringBufferRingAllocator allocator) {
            this.allocator = allocator;
            return this;
        }

        /**
         * Set allocation strategy that is used to allocate {@link ByteBuf}s.
         *
         * @param batchAllocation   {@code true} if the ring should always be filled via a batch allocation or
         *                          {@code false} if we will try to allocate a new {@link ByteBuf} as soon
         *                          as we used a buffer from the ring.
         * @return                  This builder.
         */
        public Builder batchAllocation(boolean batchAllocation) {
            this.batchAllocation = batchAllocation;
            return this;
        }

        /**
         * Set if <a href="https://github.com/axboe/liburing/wiki/
         * What's-new-with-io_uring-in-6.11-and-6.12#incremental-provided-buffer-consumption">incremental mode</a>
         * should be used for the buffer ring.
         *
         * @param incremental   {@code true} if incremental mode is used, {@code false} otherwise.
         * @return              This builder.
         */
        public Builder incremental(boolean incremental) {
            this.incremental = incremental;
            return this;
        }

        /**
         * Create a new {@link IoUringBufferRingConfig}.
         *
         * @return a new config.

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free