Uring

Main entry point to work with io_uring.

It hides SubmissionQueue and CompletionQueue behind standard range interface. We put in SubmissionEntry entries and take out CompletionEntry entries.

Use predefined prepXX methods to fill required fields of SubmissionEntry before put or during putWith.

Note: prepXX functions doesn't touch previous entry state, just fills in operation properties. This is because for less error prone interface it is cleared automatically when prepared using putWith. So when using on own SubmissionEntry (outside submission queue), that would be added to the submission queue using put, be sure its cleared if it's reused for multiple operations.

Constructors

this
this(Uring rhs)

Copy constructor

Destructor

~this
~this()

Destructor

Members

Functions

capacity
size_t capacity()

Available space in submission queue before it becomes full

dropped
uint dropped()

Counter of invalid submissions (out-of-bound index in submission array)

empty
bool empty()

Check if there is some CompletionEntry to process.

fd
int fd()

Native io_uring file descriptor

front
CompletionEntry front()

Get first CompletionEntry from cq ring

full
bool full()

Check if there is space for another SubmissionEntry to submit.

length
size_t length()

Number of entries in completion queue

next
SubmissionEntry next()

Advances the userspace submision queue and returns last SubmissionEntry.

overflow
uint overflow()

If completion queue is full, the new event maybe dropped. This value records number of dropped events.

params
SetupParameters params()

io_uring parameters

popFront
void popFront()

Move to next CompletionEntry

put
Uring put(SubmissionEntry entry)

Adds new entry to the SubmissionQueue.

put
Uring put(OP op)

Similar to put(SubmissionEntry) but in this case we can provide our custom type (args) to be filled to next SubmissionEntry in queue.

putWith
Uring putWith(ARGS args)

Adds new entry to the SubmissionQueue.

registerBuffers
int registerBuffers(T buffers)

Register single buffer to be mapped into the kernel for faster buffered operations.

registerEventFD
int registerEventFD(int eventFD)

Registers event file descriptor that would be used as a notification mechanism on completion queue change.

registerFiles
int registerFiles(const(int)[] fds)

Register files for I/O.

submit
int submit(uint want, sigset_t* sig)

Submits qued SubmissionEntry to be processed by kernel.

unregisterBuffers
int unregisterBuffers()

Releases all previously registered buffers associated with the io_uring instance.

unregisterEventFD
int unregisterEventFD()

Unregister previously registered notification event file descriptor.

unregisterFiles
int unregisterFiles()

All previously registered files associated with the io_uring instance will be unregistered.

wait
int wait(uint want, sigset_t* sig)

Simmilar to submit but with this method we just wait for required number of CompletionEntries.

Meta