|
Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
|
Template class for asynchronous operation results. More...
#include <async_operations.h>

Public Member Functions | |
| async_result (std::future< T > future) | |
| T | get () |
| T | get_for (std::chrono::milliseconds timeout) |
| bool | is_ready () const |
| std::future_status | wait_for (std::chrono::milliseconds timeout) const |
| template<concepts::VoidCallable< T > Callback> | |
| void | then (Callback &&callback) |
| template<concepts::ErrorHandler Handler> | |
| void | on_error (Handler &&error_handler) |
| void | then (std::function< void(T)> callback) |
| void | on_error (std::function< void(const std::exception &)> error_handler) |
Private Attributes | |
| std::future< T > | future_ |
| std::mutex | callback_mutex_ |
| std::function< void(T)> | success_callback_ |
| std::function< void(const std::exception &)> | error_callback_ |
Template class for asynchronous operation results.
Thread-safety: Callback registration methods (then, on_error) are thread-safe. get() and get_for() should only be called once as they consume the future.
Definition at line 90 of file async_operations.h.
| database::async::async_result< T >::async_result | ( | std::future< T > | future | ) |
Definition at line 125 of file async_operations.h.
| T database::async::async_result< T >::get | ( | ) |
Definition at line 131 of file async_operations.h.
Referenced by TEST_F(), and database::async::transaction_coordinator::two_phase_commit().

| T database::async::async_result< T >::get_for | ( | std::chrono::milliseconds | timeout | ) |
Definition at line 156 of file async_operations.h.
References database::timeout.
Referenced by TEST_F().

| bool database::async::async_result< T >::is_ready | ( | ) | const |
Definition at line 166 of file async_operations.h.
Referenced by TEST_F(), and TEST_F().

| void database::async::async_result< T >::on_error | ( | Handler && | error_handler | ) |
Definition at line 187 of file async_operations.h.
| void database::async::async_result< T >::on_error | ( | std::function< void(const std::exception &)> | error_handler | ) |
Definition at line 201 of file async_operations.h.
| void database::async::async_result< T >::then | ( | Callback && | callback | ) |
Definition at line 179 of file async_operations.h.
| void database::async::async_result< T >::then | ( | std::function< void(T)> | callback | ) |
Definition at line 194 of file async_operations.h.
| std::future_status database::async::async_result< T >::wait_for | ( | std::chrono::milliseconds | timeout | ) | const |
Definition at line 172 of file async_operations.h.
References database::timeout.
Referenced by TEST_F().

|
mutableprivate |
Definition at line 117 of file async_operations.h.
|
private |
Definition at line 119 of file async_operations.h.
|
private |
Definition at line 116 of file async_operations.h.
|
private |
Definition at line 118 of file async_operations.h.