Resilient
|
Open the circuit breaker if a number of failures happen over a time intervall. More...
#include <countstrategy.hpp>
Public Member Functions | |
CountStrategy (unsigned long failures, std::chrono::microseconds failureInterval, std::chrono::microseconds tripDuration, unsigned long recoverSuccesses, Clock clock=Clock()) | |
Construct a new Count Strategy object. More... | |
bool | allowCall () override |
Check whether the next call should be execute or should short circuit to failure. More... | |
void | registerFailure () override |
Notify the algorithm that an execution resulted in failure. | |
void | registerSuccess () override |
Notify the algorithm that an execution resulted in success. | |
Open the circuit breaker if a number of failures happen over a time intervall.
Clock | The kind of clock to use when measuring time. |
resilient::CountStrategy< Clock >::CountStrategy | ( | unsigned long | failures, |
std::chrono::microseconds | failureInterval, | ||
std::chrono::microseconds | tripDuration, | ||
unsigned long | recoverSuccesses, | ||
Clock | clock = Clock() |
||
) |
Construct a new Count Strategy object.
failures | Number of failures over the interval which will trigger the circuit breaker. |
failureInterval | The duration of the interval over which to count the failures. |
tripDuration | How long to keep the circuit breaker open once it trips. |
recoverSuccesses | How many task executions should succeed before resetting the circuit breaker to it's normal state after it triggered. |
clock | An instance of the clock to use to measure time. Defaults to a default initialized one. |
|
inlineoverridevirtual |
Check whether the next call should be execute or should short circuit to failure.
Implements resilient::ICircuitbreakerStrategy.