mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 17:40:34 +00:00
Implement file::flush()
This commit is contained in:
@@ -189,6 +189,15 @@ reactor::open_file_dma(sstring name) {
|
||||
});
|
||||
}
|
||||
|
||||
future<>
|
||||
reactor::flush(file& f) {
|
||||
return _thread_pool.submit<syscall_result<int>>([&f] {
|
||||
return wrap_syscall<int>(::fsync(f._fd));
|
||||
}).then([] (syscall_result<int> sr) {
|
||||
assert(sr.result != -1);
|
||||
return make_ready_future<>();
|
||||
});
|
||||
}
|
||||
|
||||
void reactor::run() {
|
||||
std::vector<std::unique_ptr<task>> current_tasks;
|
||||
|
||||
@@ -423,6 +423,7 @@ public:
|
||||
future<size_t> write_all(pollable_fd_state& fd, const void* buffer, size_t size);
|
||||
|
||||
future<file> open_file_dma(sstring name);
|
||||
future<> flush(file& f);
|
||||
|
||||
void run();
|
||||
|
||||
@@ -603,7 +604,9 @@ public:
|
||||
return the_reactor.write_dma(*this, pos, std::move(iov));
|
||||
}
|
||||
|
||||
future<> flush();
|
||||
future<> flush() {
|
||||
return the_reactor.flush(*this);
|
||||
}
|
||||
|
||||
friend class reactor;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user