Skip to content

Commit

Permalink
add assert for uring (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Dec 14, 2023
1 parent a5a99b2 commit 5ebe333
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/cinatra/ylt/coro_io/coro_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class coro_file {
async_simple::coro::Lazy<std::pair<std::error_code, size_t>> async_read_at(
uint64_t offset, char* data, size_t size) {
assert(stream_file_);
assert(type_ == read_type::uring_random);

auto [ec, read_size] = co_await coro_io::async_read_at(
offset,
Expand All @@ -288,6 +289,7 @@ class coro_file {
const char* data,
size_t size) {
assert(stream_file_);
assert(type_ == read_type::uring_random);

auto [ec, write_size] = co_await coro_io::async_write_at(
offset,
Expand All @@ -299,6 +301,7 @@ class coro_file {
async_simple::coro::Lazy<std::pair<std::error_code, size_t>> async_read(
char* data, size_t size) {
assert(stream_file_);
assert(type_ == read_type::uring);

auto [ec, read_size] = co_await coro_io::async_read(
*reinterpret_cast<asio::stream_file*>(stream_file_.get()),
Expand All @@ -314,6 +317,7 @@ class coro_file {
async_simple::coro::Lazy<std::error_code> async_write(const char* data,
size_t size) {
assert(stream_file_);
assert(type_ == read_type::uring);

auto [ec, write_size] = co_await coro_io::async_write(
*reinterpret_cast<asio::stream_file*>(stream_file_.get()),
Expand Down

0 comments on commit 5ebe333

Please sign in to comment.