in today's refactoring call, we discussed the topic of async reads/writes for file-based backends, using zipper's optional_yield argument we can start by trying out asio's new asio::stream_file[1] and asio::random_access_file[2] classes based on io_uring. both classes can be constructed with an existing file descriptor using the 'native_handle_type' overload an example read function: // read into the given buffer, returning the number of bytes read. throws on errors size_t read_some(asio::stream_file& file, std::span<char> buffer, optional_yield y) { if (y) { return file.async_read_some(buffer, y.get_yield_context()); } else { return file.read_some(buffer); } } the synchronous case probably won't be that simple, since we won't have an asio::io_context to construct the asio::stream_file with. we might just fall back to the read system call there [1] https://www.boost.org/doc/libs/1_79_0/doc/html/boost_asio/reference/stream_file.html [2] https://www.boost.org/doc/libs/1_79_0/doc/html/boost_asio/reference/random_access_file.html _______________________________________________ Dev mailing list -- dev@xxxxxxx To unsubscribe send an email to dev-leave@xxxxxxx