Documentation
¶
Index ¶
- Constants
- Variables
- func CreateMany(count int, entries uint32, wpCount int, opts ...SetupOption) ([]*Ring, Defer, error)
- func ReadOnceUint32(p *uint32) uint32
- func SmpLoadAcquireUint32(p *uint32) uint32
- func SmpStoreReleaseUint32(p *uint32, v uint32)
- type AcceptOp
- type CQEvent
- type CancelOp
- type CloseOp
- type ConnectOp
- type Defer
- type LinkTimeoutOp
- type NopOp
- type OpCode
- type Operation
- type Probe
- type ProvideBuffersOp
- type ReadOp
- type ReadVOp
- type RecvOp
- type Ring
- func (r *Ring) AdvanceCQ(n uint32)
- func (r *Ring) Close() error
- func (r *Ring) Fd() int
- func (r *Ring) NextSQE() (entry *SQEntry, err error)
- func (r *Ring) PeekCQE() (*CQEvent, error)
- func (r *Ring) PeekCQEventBatch(buff []*CQEvent) int
- func (r *Ring) Probe() (*Probe, error)
- func (r *Ring) QueueSQE(op Operation, flags uint8, userData uint64) error
- func (r *Ring) RegisterBuffers(buffers []syscall.Iovec) error
- func (r *Ring) RegisterFiles(descriptors []int) error
- func (r *Ring) SeenCQE(cqe *CQEvent)
- func (r *Ring) SetIOWQMaxWorkers(count int) error
- func (r *Ring) Submit() (uint, error)
- func (r *Ring) SubmitAndWaitCQEvents(cnt uint32) (cqe *CQEvent, err error)
- func (r *Ring) UnRegisterBuffers() error
- func (r *Ring) UnRegisterFiles() error
- func (r *Ring) WaitCQEvents(cnt uint32) (cqe *CQEvent, err error)
- func (r *Ring) WaitCQEventsWithTimeout(cnt uint32, timeout time.Duration) (cqe *CQEvent, err error)
- type SQEntry
- type SendOp
- type SetupOption
- type TimeoutOp
- type WriteOp
- type WriteVOp
Constants ¶
const ( SqeFixedFileFlag uint8 = 1 << 0 SqeIODrainFlag uint8 = 1 << 1 SqeIOLinkFlag uint8 = 1 << 2 SqeIOHardLinkFlag uint8 = 1 << 3 SqeAsyncFlag uint8 = 1 << 4 SqeBufferSelectFlag uint8 = 1 << 5 )
SQE flags
const MaxEntries uint32 = 1 << 15
const OpSupportedFlag uint16 = 1 << 0
Variables ¶
var ErrRingSetup = errors.New("ring setup")
var ErrSQOverflow = errors.New("sq ring overflow")
Functions ¶
func CreateMany ¶
func CreateMany(count int, entries uint32, wpCount int, opts ...SetupOption) ([]*Ring, Defer, error)
CreateMany create multiple io_uring instances. Entries - size of SQ and CQ buffers. count - the number of io_uring instances. wpCount - the number of worker pools, this value must be a multiple of the entries. If workerCount < count worker pool will be shared with setupAttachWQ flag.
func ReadOnceUint32 ¶
func SmpLoadAcquireUint32 ¶
func SmpStoreReleaseUint32 ¶
Types ¶
type AcceptOp ¶
type AcceptOp struct {
// contains filtered or unexported fields
}
AcceptOp accept command.
type CancelOp ¶
type CancelOp struct {
// contains filtered or unexported fields
}
CancelOp attempt to cancel an already issued request.
func Cancel ¶
Cancel create CancelOp. Put in targetUserData value of user_data field of the request that should be cancelled.
func (*CancelOp) SetTargetUserData ¶
type CloseOp ¶
type CloseOp struct {
// contains filtered or unexported fields
}
CloseOp closes a file descriptor, equivalent of a close(2) system call.
type ConnectOp ¶
type ConnectOp struct {
// contains filtered or unexported fields
}
ConnectOp connect operation, equivalent of a connect(2) system call.
type LinkTimeoutOp ¶
type LinkTimeoutOp struct {
// contains filtered or unexported fields
}
LinkTimeoutOp IORING_OP_LINK_TIMEOUT command.
func LinkTimeout ¶
func LinkTimeout(duration time.Duration) *LinkTimeoutOp
LinkTimeout - timeout operation for linked command. Note: previous queued SQE must be queued with flag SqeIOLinkFlag.
func (*LinkTimeoutOp) Code ¶
func (op *LinkTimeoutOp) Code() OpCode
func (*LinkTimeoutOp) PrepSQE ¶
func (op *LinkTimeoutOp) PrepSQE(sqe *SQEntry)
type NopOp ¶
type NopOp struct { }
NopOp - do not perform any I/O. This is useful for testing the performance of the io_uring implementation itself.
type ProvideBuffersOp ¶
type ProvideBuffersOp struct {
// contains filtered or unexported fields
}
ProvideBuffersOp .
func ProvideBuffers ¶
func ProvideBuffers(buff []byte, bufferId uint64, groupId uint16) *ProvideBuffersOp
ProvideBuffers .
func (*ProvideBuffersOp) Code ¶
func (op *ProvideBuffersOp) Code() OpCode
func (*ProvideBuffersOp) PrepSQE ¶
func (op *ProvideBuffersOp) PrepSQE(sqe *SQEntry)
type ReadOp ¶
type ReadOp struct {
// contains filtered or unexported fields
}
ReadOp read operation, equivalent of a pread(2) system call.
type ReadVOp ¶
ReadVOp vectored read operation, similar to preadv2(2).
type RecvOp ¶
type RecvOp struct {
// contains filtered or unexported fields
}
RecvOp receive a message from a socket operation.
type Ring ¶
type Ring struct { Params *ringParams // contains filtered or unexported fields }
Ring io_uring instance.
func New ¶
func New(entries uint32, opts ...SetupOption) (*Ring, error)
New create new io_uring instance with. Entries - size of SQ and CQ buffers.
func (*Ring) PeekCQEventBatch ¶
PeekCQEventBatch fill buffer by available CQEs. Return count of filled CQEs.
func (*Ring) RegisterBuffers ¶
RegisterBuffers register shared buffers.
func (*Ring) RegisterFiles ¶
RegisterFiles register shared files.
func (*Ring) SetIOWQMaxWorkers ¶
SetIOWQMaxWorkers provides a way to change worker count per ring.
func (*Ring) SubmitAndWaitCQEvents ¶
SubmitAndWaitCQEvents submit new SQEs in SQE and wait cnt CQEs in CQ. Return first available CQE.
func (*Ring) WaitCQEvents ¶
WaitCQEvents wait cnt CQEs in CQ.
type SendOp ¶
type SendOp struct {
// contains filtered or unexported fields
}
SendOp send a message to a socket operation.
type SetupOption ¶
type SetupOption func(params *ringParams)
func WithAttachedWQ ¶
func WithAttachedWQ(fd int) SetupOption
WithAttachedWQ use worker pool from another io_uring instance.
func WithSQPoll ¶
func WithSQPoll(threadIdle time.Duration) SetupOption
WithSQPoll add IORING_SETUP_SQPOLL flag. Note, that process must started with root privileges or the user should have the CAP_SYS_NICE capability (for kernel version >= 5.11).
func WithSQThreadCPU ¶
func WithSQThreadCPU(cpu uint32) SetupOption
WithSQThreadCPU bound poll thread to the cpu.
type TimeoutOp ¶
type TimeoutOp struct {
// contains filtered or unexported fields
}
TimeoutOp timeout command.
type WriteOp ¶
type WriteOp struct {
// contains filtered or unexported fields
}
WriteOp write operation, equivalent of a pwrite(2) system call.