Class IdRateLimiter

java.lang.Object
com.io7m.idstore.server.service.ratelimit.IdRateLimiter

public final class IdRateLimiter extends Object
A trivial rate limiter.
  • Method Details

    • create

      public static IdRateLimiter create(IdServerTelemetryServiceType 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
    • toString

      public String toString()
      Overrides:
      toString in class Object