compio_driver/buffer_pool/mod.rs
1cfg_if::cfg_if! {
2 if #[cfg(io_uring)] {
3 cfg_if::cfg_if! {
4 if #[cfg(fusion)] {
5 mod fusion;
6 pub use fusion::*;
7 } else {
8 mod iour;
9 pub use iour::*;
10 }
11 }
12 } else {
13 mod fallback;
14 pub use fallback::*;
15 }
16}
17
18/// Trait to get the selected buffer of an io operation.
19pub trait TakeBuffer {
20 /// Selected buffer type. It keeps the reference to the buffer pool and
21 /// returns the buffer back on drop.
22 type Buffer<'a>;
23
24 /// Buffer pool type.
25 type BufferPool;
26
27 /// Take the selected buffer with `buffer_pool`, io `result` and `flags`, if
28 /// io operation is success.
29 fn take_buffer(
30 self,
31 buffer_pool: &Self::BufferPool,
32 result: std::io::Result<usize>,
33 flags: u32,
34 ) -> std::io::Result<Self::Buffer<'_>>;
35}