Implement common interfaces
Opened this issue · 3 comments
It would be great if there was a IoUringFile class that implemented common interfaces.
This would allow providing io_uring-based file providers for existing platforms.
java.io.DataOutput, java.io.DataInput, java.io.Closeable
This is a great idea that would really enhance the utility of the project.
One thing that may cause confusion though, is that no I/O operations will execute unless execute()
is called on the ring, or there is a thread in the background running the loop()
method. Wondering what your thoughts are on how to approach this, or is documentation enough?
How about something along the lines of a RandomAccessFileFactory?
- start() / stop() methods to handle the state of the ring buffers and if a dedicated thread is needed
- createRandomAccessFile() method to pass a io_uring enabled-File instance to applications?
Great points, however this does have implications that may require changing the way the nio_uring API is designed. At this time, all I/O operations are called on an IoUring
object as opposed to the file or socket object; this reflects the internal native approach, where all operations are indeed executed by the liburing API itself.
This would involve moving the read/write/accept methods into the base IoUringChannel
class, and having two overloaded versions for each - one that takes an IoUring
as an argument, and one that does not but instead uses a default "internal" ring that runs similar to the ForkJoinPool
used for parallel Java streams.
I'll think on this though, and see if I can find a less destructive approach.