Class RateLimitResult

java.lang.Object
org.gridgain.internal.mcp.ratelimit.RateLimitResult

public class RateLimitResult extends Object
Result of a rate limit check. Contains information about whether the request was allowed and rate limit details.
  • Constructor Details

    • RateLimitResult

      public RateLimitResult(boolean allowed, int limitPerMinute, int remaining, long retryAfterMs)
      Creates a rate limit result.
      Parameters:
      allowed - Whether the request is allowed
      limitPerMinute - The rate limit (queries per minute)
      remaining - Number of remaining tokens
      retryAfterMs - Milliseconds until next token available (0 if allowed)
  • Method Details

    • isAllowed

      public boolean isAllowed()
      Whether the request is allowed.
    • getLimitPerMinute

      public int getLimitPerMinute()
      The configured rate limit (queries per minute).
    • getRemaining

      public int getRemaining()
      Number of remaining tokens/queries available.
    • getRetryAfterMs

      public long getRetryAfterMs()
      Milliseconds until the next token becomes available. Returns 0 if tokens are currently available.
    • getRetryAfterSeconds

      public long getRetryAfterSeconds()
      Returns retry time in seconds (rounded up).
    • shouldWarn

      public boolean shouldWarn()
      Checks if remaining tokens are below the warning threshold (20%).
    • toString

      public String toString()
      Overrides:
      toString in class Object