Design Authentication Manager (LeetCode 1797) with a constraint of 10^5 queries.
Asked in the Coding round stage. For this SQL version, process the ordered authentication operations and return the number of unexpired tokens whenever a count operation occurs. A token is valid only when its expiration time is strictly greater than the operation time. Generating an existing token replaces its expiration time, while renewing an expired or unknown token has no effect.
count operation with query_id, event_time, and active_token_count.query_id ascending.| Column | Type | Description |
|---|---|---|
| manager_idPK | INT | Authentication manager identifier |
| time_to_live | INT | Token lifetime in time units |
| Column | Type | Description |
|---|---|---|
| query_idPK | INT | Sequence identifier for an authentication operation |
| manager_id | INT | Authentication manager used by the operation |
| operation | VARCHAR(20) | Operation name: generate, renew, or count |
| token_id | VARCHAR(100) | Token affected by generate or renew |
| event_time | INT | Time at which the operation occurs |