Documentation
¶
Overview ¶
Package iouring implements an engine backed by Linux io_uring.
Index ¶
- type BufferGroup
- type Engine
- type Ring
- func (r *Ring) AdvanceCQ()
- func (r *Ring) Close() error
- func (r *Ring) GetSQE() unsafe.Pointer
- func (r *Ring) Submit() (int, error)
- func (r *Ring) SubmitAndWait() error
- func (r *Ring) SubmitAndWaitTimeout(timeout time.Duration) error
- func (r *Ring) WaitCQE() error
- func (r *Ring) WakeupSQPoll() error
- type TierStrategy
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferGroup ¶
type BufferGroup struct {
// contains filtered or unexported fields
}
BufferGroup manages a group of provided buffers for multishot recv.
func NewBufferGroup ¶
func NewBufferGroup(ring *Ring, groupID uint16, count, size int) (*BufferGroup, error)
NewBufferGroup creates and registers a provided buffer group with the ring.
func (*BufferGroup) AvailableCount ¶
func (bg *BufferGroup) AvailableCount() int
AvailableCount returns the number of available buffers.
func (*BufferGroup) GetBuffer ¶
func (bg *BufferGroup) GetBuffer(bufID uint16) []byte
GetBuffer returns the buffer for the given buffer ID.
func (*BufferGroup) ReturnBuffer ¶
func (bg *BufferGroup) ReturnBuffer(ring *Ring, bufID uint16) error
ReturnBuffer returns a buffer to the group and re-provides it to the kernel.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine implements the io_uring-based I/O engine.
func (*Engine) Metrics ¶
func (e *Engine) Metrics() engine.EngineMetrics
Metrics returns a snapshot of engine metrics.
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring is an io_uring instance with mmap'd SQ/CQ rings and SQE array.
func (*Ring) GetSQE ¶
GetSQE returns a pointer to the next available SQE, or nil if the ring is full.
func (*Ring) SubmitAndWait ¶
SubmitAndWait submits pending SQEs and waits for at least one CQE.
func (*Ring) SubmitAndWaitTimeout ¶
SubmitAndWaitTimeout submits pending SQEs and waits for at least one CQE, with a timeout. Returns nil on timeout (ETIME) or EINTR.
func (*Ring) WakeupSQPoll ¶
WakeupSQPoll wakes up the SQPOLL thread if it went to sleep.
type TierStrategy ¶
type TierStrategy interface {
Tier() engine.Tier
SetupFlags() uint32
PrepareAccept(ring *Ring, listenFD int)
PrepareRecv(ring *Ring, fd int, buf []byte)
PrepareSend(ring *Ring, fd int, buf []byte, linked bool)
SupportsProvidedBuffers() bool
SupportsMultishotAccept() bool
SupportsMultishotRecv() bool
SQPollIdle() uint32
}
TierStrategy configures io_uring behavior based on detected capabilities.
func SelectTier ¶
func SelectTier(profile engine.CapabilityProfile) TierStrategy
SelectTier returns the highest available tier strategy for the given profile.