1 #ifndef IO_URING_ENGINE_H
2 #define IO_URING_ENGINE_H 1
13 void submit_read(int fd, size_t len, off_t offset, std::function<void(std::string)> cb);
15 size_t get_waiting_reads() const { return pending_reads + queued_reads.size(); }
18 void submit_read_internal(io_uring_sqe *sqe, int fd, size_t len, off_t offset, std::function<void(std::string)> cb);
21 size_t pending_reads = 0; // Number of requests we have going in the ring.
28 std::function<void(std::string)> cb;
30 std::queue<QueuedRead> queued_reads;
35 std::function<void(std::string)> cb;
43 // 256 simultaneous requests should be ample, for slow and fast media alike.
44 static constexpr size_t queue_depth = 256;
47 // A wrapper around pread() that returns an incomplete read.
48 // Always synchronous (no io_uring).
49 void complete_pread(int fd, void *ptr, size_t len, off_t offset);
51 #endif // !defined(IO_URING_ENGINE_H)