Closed ohpauleez closed 1 month ago
Great request! I think a good way to do this would be to:
Java_sh_blake_niouring_IoUring_queueRead
and Java_sh_blake_niouring_IoUring_queueWrite
functions to accept an offset
parameter (which then pass it to the io_uring call)queueRead
and queueWrite
methods to accept an offset
parameter, which is passed to the native call, keeping the other logic intactqueueRead
and queueWrite
methods without an offset
parameter (to not break the existing API), that simply call the other versions with an offset
value of 0A PR would be awesome if you're up to it! Otherwise I will try to get to this soon.
I'm about to test this, but changes are sitting on this branch: https://github.com/ohpauleez/nio_uring/tree/queue_with_offset
Edit: Tested locally in a project that seeks across large files / datasets. Everything looks correct. Edit2: Included a unit test.
Released on Maven Central as version 0.1.4, thank you for your contribution!
In the current implementation, it appears as though the file offset is always set to
0
: https://github.com/bbeaupain/nio_uring/blob/main/src/main/c/liburing_provider.c#L239I would like to continue reading large files with subsequent reads or seeking to a specific position within a known file and reading a specific number of bytes from that point. What are your thoughts on exposing a
queueRead
method that takes an offset argument to forward to prep_read?(I'm happy to take some direction and make contributions)