Class IoUringBufferRing
java.lang.Object
io.netty.channel.uring.IoUringBufferRing
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate final IoUringBufferRingAllocatorprivate final booleanprivate final intprivate final shortprivate final ByteBuf[]private booleanprivate booleanprivate final shortprivate final IoUringBufferRingExhaustedEventprivate final booleanprivate final ByteBufferprivate shortprivate final shortprivate booleanprivate final IoUringBufferRing.RingConsumerprivate final intprivate static final VarHandleprivate final intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionIoUringBufferRing(int ringFd, ByteBuffer ioUringBufRing, short entries, int batchSize, short bufferGroupId, boolean incremental, IoUringBufferRingAllocator allocator, boolean batchAllocation) -
Method Summary
Modifier and TypeMethodDescription(package private) intattemptedBytesRead(short bid) Return the amount of bytes that we attempted to read for the given id.(package private) shortThe group id that is assigned to this buffer ring.private int(package private) voidclose()Close thisIoUringBufferRing, using it after this method is called will lead to undefined behaviour.(package private) booleanexpand()Try to expand by adding more buffers to the ring if there is any space left, this will be done lazy.private voidfill(short bid) private voidfill(short startBid, int buffers) (package private) IoUringBufferRingExhaustedEvent(package private) void(package private) booleanisUsable()(package private) shortnextBid(short bid) (package private) ByteBufuseBuffer(short bid, int read, boolean more) Use the buffer for the given buffer id.
-
Field Details
-
SHORT_HANDLE
-
ioUringBufRing
-
tailFieldPosition
private final int tailFieldPosition -
entries
private final short entries -
mask
private final short mask -
bufferGroupId
private final short bufferGroupId -
ringFd
private final int ringFd -
buffers
-
allocator
-
batchAllocation
private final boolean batchAllocation -
exhaustedEvent
-
ringConsumer
-
incremental
private final boolean incremental -
batchSize
private final int batchSize -
corrupted
private boolean corrupted -
closed
private boolean closed -
usableBuffers
private int usableBuffers -
allocatedBuffers
private int allocatedBuffers -
needExpand
private boolean needExpand -
lastGeneratedBid
private short lastGeneratedBid
-
-
Constructor Details
-
IoUringBufferRing
IoUringBufferRing(int ringFd, ByteBuffer ioUringBufRing, short entries, int batchSize, short bufferGroupId, boolean incremental, IoUringBufferRingAllocator allocator, boolean batchAllocation)
-
-
Method Details
-
isUsable
boolean isUsable() -
initialize
void initialize() -
expand
boolean expand()Try to expand by adding more buffers to the ring if there is any space left, this will be done lazy.- Returns:
trueif we can expand the number of buffers in the ring,falseotherwise.
-
fill
private void fill(short startBid, int buffers) -
fill
private void fill(short bid) -
getExhaustedEvent
IoUringBufferRingExhaustedEvent getExhaustedEvent()- Returns:
- the
IoUringBufferRingExhaustedEventthat should be used to signal that there were no buffers left for this buffer ring.
-
attemptedBytesRead
int attemptedBytesRead(short bid) Return the amount of bytes that we attempted to read for the given id. This method must be called beforeuseBuffer(short, int, boolean).- Parameters:
bid- the id of the buffer.- Returns:
- the attempted bytes.
-
calculateNextBufferBatch
private int calculateNextBufferBatch() -
useBuffer
-
nextBid
short nextBid(short bid) -
bufferGroupId
short bufferGroupId()The group id that is assigned to this buffer ring.- Returns:
- group id.
-
close
void close()Close thisIoUringBufferRing, using it after this method is called will lead to undefined behaviour.
-