mal-packet-weaver
C++20 packet serialization/deserialization library.
|
A utility class for implementing linear backoff strategies. More...
#include "backoffs.hpp"
Public Member Functions | |
constexpr | LinearBackoff (ChronoType initial_delay, ChronoType max_delay, ChronoType step) |
Constructor to initialize the linear backoff strategy. | |
constexpr ChronoType | get_current_delay () const noexcept |
Get the current backoff delay. | |
constexpr double | get_current_delay_double () const noexcept |
Get the current backoff delay as a double. | |
constexpr void | increase_delay () noexcept |
Increase the backoff delay using the specified step. | |
constexpr void | decrease_delay () noexcept |
Decrease the backoff delay using the specified step. | |
constexpr void | reset_delay () noexcept |
Reset the backoff delay to its initial value. | |
Private Attributes | |
const ChronoType | initial_delay_ |
The initial delay before the first retry. | |
const ChronoType | max_delay_ |
The maximum delay allowed between retries. | |
const ChronoType | step_ |
The increment step used to increase or decrease the delay. | |
ChronoType | current_delay_ |
The current backoff delay. | |
A utility class for implementing linear backoff strategies.
Linear backoff is a strategy where the delay between retries increases linearly. This class provides functionality to manage and manipulate the backoff delay.
ChronoType | The type representing the time duration (e.g., std::chrono::milliseconds). |
Definition at line 110 of file backoffs.hpp.
|
inlineconstexpr |
Constructor to initialize the linear backoff strategy.
initial_delay | The initial delay before the first retry. |
max_delay | The maximum delay allowed between retries. |
step | The increment step used to increase or decrease the delay. |
Definition at line 120 of file backoffs.hpp.
|
inlineconstexprnoexcept |
Decrease the backoff delay using the specified step.
Definition at line 150 of file backoffs.hpp.
|
inlineconstexprnoexcept |
Get the current backoff delay.
Definition at line 130 of file backoffs.hpp.
|
inlineconstexprnoexcept |
Get the current backoff delay as a double.
Definition at line 137 of file backoffs.hpp.
|
inlineconstexprnoexcept |
Increase the backoff delay using the specified step.
Definition at line 145 of file backoffs.hpp.
|
inlineconstexprnoexcept |
Reset the backoff delay to its initial value.
Definition at line 155 of file backoffs.hpp.
|
private |
The current backoff delay.
Definition at line 161 of file backoffs.hpp.
|
private |
The initial delay before the first retry.
Definition at line 158 of file backoffs.hpp.
|
private |
The maximum delay allowed between retries.
Definition at line 159 of file backoffs.hpp.
|
private |
The increment step used to increase or decrease the delay.
Definition at line 160 of file backoffs.hpp.