SlidingWindow

ox.resilience.StartTimeRateLimiterAlgorithm.SlidingWindow
case class SlidingWindow(rate: Int, per: FiniteDuration) extends RateLimiterAlgorithm

Sliding window algorithm: allows to start at most rate operations in the lapse of per before current time.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def acquire(permits: Int): Unit

Acquires permits to execute the operation. This method should block until a permit is available.

Acquires permits to execute the operation. This method should block until a permit is available.

Attributes

def getNextUpdate: Long

Returns the time in nanoseconds that needs to elapse until the next update. It should not modify internal state.

Returns the time in nanoseconds that needs to elapse until the next update. It should not modify internal state.

Attributes

def runOperation[T](operation: => T, permits: Int): T

Runs the operation, allowing the algorithm to take into account its duration, if needed.

Runs the operation, allowing the algorithm to take into account its duration, if needed.

Attributes

def tryAcquire(permits: Int): Boolean

Tries to acquire permits to execute the operation. This method should not block.

Tries to acquire permits to execute the operation. This method should not block.

Attributes

def update(): Unit

Updates the internal state of the rate limiter to check whether new operations can be accepted.

Updates the internal state of the rate limiter to check whether new operations can be accepted.

Attributes

Inherited methods

final def acquire(): Unit

Acquires a permit to execute the operation. This method should block until a permit is available.

Acquires a permit to execute the operation. This method should block until a permit is available.

Attributes

Inherited from:
RateLimiterAlgorithm
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
final def runOperation[T](operation: => T): T

Runs the operation, allowing the algorithm to take into account its duration, if needed.

Runs the operation, allowing the algorithm to take into account its duration, if needed.

Attributes

Inherited from:
RateLimiterAlgorithm
final def tryAcquire(): Boolean

Tries to acquire a permit to execute the operation. This method should not block.

Tries to acquire a permit to execute the operation. This method should not block.

Attributes

Inherited from:
RateLimiterAlgorithm