Package com.io7m.idstore.server.internal
Class IdRateLimiter
java.lang.Object
com.io7m.idstore.server.internal.IdRateLimiter
A trivial rate limiter.
-
Method Summary
Modifier and TypeMethodDescriptionstatic IdRateLimitercreate(IdServerTelemetryService telemetry, String name, long expiration, TimeUnit timeUnit) Create a rate limiter.booleanisAllowedByRateLimit(String host, String user, String operation)
-
Method Details
-
create
public static IdRateLimiter create(IdServerTelemetryService telemetry, String name, long expiration, TimeUnit timeUnit) Create a rate limiter.- Parameters:
telemetry- The telemetry servicename- The rate nameexpiration- The expiration for tokenstimeUnit- The time unit for expirations- Returns:
- A rate limiter
-
isAllowedByRateLimit
- Parameters:
host- The host performing the actionuser- The user performing the actionoperation- The operation- Returns:
trueif the given operation is allowed by rate limiting
-