CountBasedSlidingWindow
internal class CountBasedSlidingWindow(val capacity: Int, val minimumThroughput: Int) : FailureRateSlidingWindow<Boolean> (source)
A sliding window implementation that uses a count-based approach. To simplify the implementation, the window will only record boolean values, where true
represents a successful operation and false
represents a failed operation.
Parameters
capacity
the fixed size of the window.
minimumThroughput
the minimum number of calls that need to be recorded in the window for the failure rate to be calculated. Even if capacity is reached, the failure rate will not be calculated if the number of calls recorded in the window is less than this value.
Functions
Link copied to clipboard
Returns the current failure rate of the system.
Link copied to clipboard
Records a failed operation. The term "failed" depends on the implementation.
Link copied to clipboard
Link copied to clipboard
Records a successful operation. The term "successful" depends on the implementation.