mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-22 08:25:29 +01:00
Implement register_fixed_buffer for io_uring IO backend
This commit is contained in:
@@ -460,6 +460,29 @@ impl IO for UringIO {
|
||||
fn get_memory_io(&self) -> Arc<MemoryIO> {
|
||||
Arc::new(MemoryIO::new())
|
||||
}
|
||||
|
||||
fn register_fixed_buffer(&self, ptr: std::ptr::NonNull<u8>, len: usize) -> Result<()> {
|
||||
turso_assert!(
|
||||
len % 512 == 0,
|
||||
"fixed buffer length must be logical block aligned"
|
||||
);
|
||||
let inner = self.inner.borrow_mut();
|
||||
let default_id = 0;
|
||||
unsafe {
|
||||
// RL_MEMLOCK cap is typically 8MB, the current design is to have one large arena
|
||||
// registered at startup and therefore we can simply use the zero index, falling back
|
||||
// to similar logic as the existing buffer pool for cases where it is over capacity.
|
||||
inner.ring.ring.submitter().register_buffers_update(
|
||||
default_id,
|
||||
&[libc::iovec {
|
||||
iov_base: ptr.as_ptr() as *mut libc::c_void,
|
||||
iov_len: len,
|
||||
}],
|
||||
None,
|
||||
)?
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Clock for UringIO {
|
||||
|
||||
Reference in New Issue
Block a user