ByteBuf() — netty Function Reference
Architecture documentation for the ByteBuf() function in IoUringBufferRing.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 7239275a_8363_2f7a_8f34_d001615b1b74["ByteBuf()"] f317c5ef_c638_0e8e_3895_73aa2a88fdad["IoUringBufferRing"] 7239275a_8363_2f7a_8f34_d001615b1b74 -->|defined in| f317c5ef_c638_0e8e_3895_73aa2a88fdad 87db609e_20fd_3805_6364_ac492e213003["calculateNextBufferBatch()"] 7239275a_8363_2f7a_8f34_d001615b1b74 -->|calls| 87db609e_20fd_3805_6364_ac492e213003 d66ab72f_36b1_f061_59f8_5e5807458880["fill()"] 7239275a_8363_2f7a_8f34_d001615b1b74 -->|calls| d66ab72f_36b1_f061_59f8_5e5807458880 style 7239275a_8363_2f7a_8f34_d001615b1b74 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringBufferRing.java lines 220–265
ByteBuf useBuffer(short bid, int read, boolean more) {
assert read > 0;
ByteBuf byteBuf = buffers[bid];
allocator.lastBytesRead(byteBuf.writableBytes(), read);
// We always slice so the user will not mess up things later.
ByteBuf buffer = byteBuf.retainedSlice(byteBuf.writerIndex(), read);
byteBuf.writerIndex(byteBuf.writerIndex() + read);
if (incremental && more && byteBuf.isWritable()) {
// The buffer will be used later again, just slice out what we did read so far.
return buffer;
}
// The buffer is considered to be used, null out the slot.
buffers[bid] = null;
byteBuf.release();
if (--usableBuffers == 0) {
int numBuffers = allocatedBuffers;
if (needExpand) {
// We did get a signal that our buffer ring did not have enough buffers, let's see if we
// can grow it.
needExpand = false;
numBuffers += calculateNextBufferBatch();
}
fill((short) 0, numBuffers);
allocatedBuffers = numBuffers;
assert allocatedBuffers % 2 == 0;
} else if (!batchAllocation) {
// If we don'T do bulk allocations to refill the buffer ring we need to fill in the just used bid again
// if we didn't get a signal that we need expansion.
fill(bid);
if (needExpand && lastGeneratedBid == bid) {
// We did get a signal that our buffer ring did not have enough buffers and we just did add the last
// generated bid at the tail of the ring. Now its safe to grow the buffer ring and still guarantee
// sequential ordering which is needed for our RECVSEND_BUNDLE implementation.
needExpand = false;
int numBuffers = calculateNextBufferBatch();
fill((short) (bid + 1), numBuffers);
allocatedBuffers += numBuffers;
assert allocatedBuffers % 2 == 0;
}
}
return buffer;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does ByteBuf() do?
ByteBuf() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringBufferRing.java.
Where is ByteBuf() defined?
ByteBuf() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringBufferRing.java at line 220.
What does ByteBuf() call?
ByteBuf() calls 2 function(s): calculateNextBufferBatch, fill.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free