Implement the rate limiter implementations.
Use the supplied API request and policy data to calculate decisions for fixed-window, sliding-window, and token-bucket implementations. Return one result for every request covered by a policy.
request_id, policy_id, request_ts, fixed_window_allowed, sliding_window_allowed, token_bucket_allowedrequest_id ascending| Column | Type | Description |
|---|---|---|
| policy_idPK | INT | Unique rate limit policy identifier |
| endpoint | VARCHAR(100) | API endpoint covered by the policy |
| max_requests | INT | Maximum requests permitted in one fixed or sliding window |
| window_seconds | INT | Window duration in seconds |
| bucket_capacity | INT | Maximum number of tokens held by the bucket |
| refill_per_second | NUMERIC(8,4) | Tokens added per second |
| Column | Type | Description |
|---|---|---|
| request_idPK | INT | Unique API request identifier |
| policy_id | INT | Applied rate limit policy |
| request_ts | TIMESTAMP | Timestamp when the request arrived |
| client_name | VARCHAR(100) | Logical client making the request |
| user_agent | VARCHAR(200) | Optional client user agent |