Package com.io7m.idstore.server.internal

# Class IdRateLimiter

java.lang.Object
com.io7m.idstore.server.internal.IdRateLimiter

public final class IdRateLimiter extends Object
A trivial rate limiter.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static IdRateLimiter`
  `create(IdServerTelemetryService telemetry, String name, long expiration, TimeUnit timeUnit)`
  Create a rate limiter.
  `boolean`
  `isAllowedByRateLimit(String host, String user, String operation)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### create

    public static IdRateLimiter create(IdServerTelemetryService telemetry, String name, long expiration, TimeUnit timeUnit)
    Create a rate limiter.
    Parameters:
      `telemetry` - The telemetry service
      `name` - The rate name
      `expiration` - The expiration for tokens
      `timeUnit` - The time unit for expirations
    Returns:
      A rate limiter

  - ### isAllowedByRateLimit

    public boolean isAllowedByRateLimit(String host, String user, String operation)
    Parameters:
      `host` - The host performing the action
      `user` - The user performing the action
      `operation` - The operation
    Returns:
      `true` if the given operation is allowed by rate limiting