quill_sql/storage/io/
mod.rs1use bytes::{Bytes, BytesMut};
2use std::sync::mpsc::Receiver;
3
4use crate::buffer::PageId;
5use crate::error::QuillSQLResult;
6
7pub type DiskCommandResultReceiver<T> = Receiver<QuillSQLResult<T>>;
8
9pub trait IOBackend: Send + Sync {
12 fn schedule_read(&self, page_id: PageId)
14 -> QuillSQLResult<DiskCommandResultReceiver<BytesMut>>;
15 fn schedule_read_pages(
17 &self,
18 page_ids: Vec<PageId>,
19 ) -> QuillSQLResult<DiskCommandResultReceiver<Vec<BytesMut>>>;
20 fn schedule_write(
22 &self,
23 page_id: PageId,
24 data: Bytes,
25 ) -> QuillSQLResult<DiskCommandResultReceiver<()>>;
26 fn schedule_allocate(&self) -> QuillSQLResult<DiskCommandResultReceiver<PageId>>;
28 fn schedule_deallocate(&self, page_id: PageId)
30 -> QuillSQLResult<DiskCommandResultReceiver<()>>;
31}
32
33#[cfg_attr(not(target_os = "linux"), allow(unused))]
34pub mod thread_pool;
35
36#[cfg(target_os = "linux")]
37pub mod iouring;