![]() |
Kurlyk
|
Represents the context of an HTTP request, including the request object, callback function, retry attempts, and timing. More...
#include <HttpRequestContext.hpp>
Public Types | |
| using | time_point_t = std::chrono::steady_clock::time_point |
Public Member Functions | |
| HttpRequestContext (std::unique_ptr< HttpRequest > request_ptr, HttpResponseCallback callback) | |
| Constructs a HttpRequestContext with the specified request and callback. | |
| HttpRequestContext ()=default | |
| void | complete () |
| Invokes on_complete exactly once. Thread-safe and idempotent. | |
Public Attributes | |
| std::unique_ptr< HttpRequest > | request |
| The HTTP request associated with this context. | |
| HttpResponseCallback | callback |
| Callback function to be invoked when the request completes. | |
| long | retry_attempt |
| Number of retry attempts made for this request. | |
| time_point_t | start_time |
| Time when the request was initially created or last retried. | |
| uint64_t | in_flight_token = 0 |
| Token for sequential rate-limit tracking. | |
| std::function< void()> | on_complete |
| Callback invoked once when the request finishes (including retries). | |
| std::atomic< bool > | complete_called {false} |
| True after on_complete has been invoked. | |
Represents the context of an HTTP request, including the request object, callback function, retry attempts, and timing.
Definition at line 12 of file HttpRequestContext.hpp.
| using kurlyk::HttpRequestContext::time_point_t = std::chrono::steady_clock::time_point |
Definition at line 14 of file HttpRequestContext.hpp.
|
inline |
Constructs a HttpRequestContext with the specified request and callback.
| request_ptr | A unique pointer to the HTTP request object. |
| callback | Callback function to be invoked upon request completion. |
Definition at line 27 of file HttpRequestContext.hpp.
|
default |
|
inline |
Invokes on_complete exactly once. Thread-safe and idempotent.
Definition at line 40 of file HttpRequestContext.hpp.
| HttpResponseCallback kurlyk::HttpRequestContext::callback |
Callback function to be invoked when the request completes.
Definition at line 17 of file HttpRequestContext.hpp.
| std::atomic<bool> kurlyk::HttpRequestContext::complete_called {false} |
True after on_complete has been invoked.
Definition at line 22 of file HttpRequestContext.hpp.
| uint64_t kurlyk::HttpRequestContext::in_flight_token = 0 |
Token for sequential rate-limit tracking.
Definition at line 20 of file HttpRequestContext.hpp.
| std::function<void()> kurlyk::HttpRequestContext::on_complete |
Callback invoked once when the request finishes (including retries).
Definition at line 21 of file HttpRequestContext.hpp.
| std::unique_ptr<HttpRequest> kurlyk::HttpRequestContext::request |
The HTTP request associated with this context.
Definition at line 16 of file HttpRequestContext.hpp.
| long kurlyk::HttpRequestContext::retry_attempt |
Number of retry attempts made for this request.
Definition at line 18 of file HttpRequestContext.hpp.
| time_point_t kurlyk::HttpRequestContext::start_time |
Time when the request was initially created or last retried.
Definition at line 19 of file HttpRequestContext.hpp.