Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /limit_request_rate /dchrnv_neurograph.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Entity", | |
| "status": "present", | |
| "symbol": "_request", | |
| "file": "python-client/neurograph/client.py", | |
| "lines": "102", | |
| "notes": "In-repo SDK NeuroGraphClient._request sends HTTP requests to the NeuroGraph API (e.g. TokensAPI.create -> POST /api/v1/tokens, client.py:224) which pass through the Enforcer dispatch (src/api/middlewares/rate_limit.py:178); _handle_error_response (client.py:174) maps the Enforcer's 429 to RateLimitError." | |
| }, | |
| { | |
| "role": "Enforcer", | |
| "status": "present", | |
| "symbol": "dispatch", | |
| "file": "src/api/middlewares/rate_limit.py", | |
| "lines": "178", | |
| "notes": "RateLimitMiddleware.dispatch, registered via app.add_middleware(RateLimitMiddleware, ...) at src/api/main.py:114, intercepts every incoming HTTP request (health exempt), derives the id via get_user_id (rate_limit.py:110: user/API-key prefix/IP), asks the bucket's consume (line 191) and returns 429 with Retry-After when blocked, else call_next (line 225)." | |
| }, | |
| { | |
| "role": "Limiter", | |
| "status": "present", | |
| "symbol": "consume", | |
| "file": "src/api/middlewares/rate_limit.py", | |
| "lines": "37", | |
| "notes": "Called by Enforcer dispatch at rate_limit.py:191. TokenBucket.consume refills tokens by elapsed time up to capacity and returns True (allow) if a token is available, False (block) otherwise; it also updates the bucket state (tokens/last_update)." | |
| }, | |
| { | |
| "role": "HistoryProvider", | |
| "status": "present", | |
| "symbol": "get_bucket", | |
| "file": "src/api/middlewares/rate_limit.py", | |
| "lines": "133", | |
| "notes": "Called by Enforcer dispatch at rate_limit.py:188 to fetch the per-id TokenBucket from the in-memory dict self.buckets (declared line 105) and record last_access; the bucket's tokens/last_update are the request history consumed and updated by Limiter consume (line 37). Stale buckets pruned by cleanup_old_buckets (line 155)." | |
| }, | |
| { | |
| "role": "PolicyProvider", | |
| "status": "present", | |
| "symbol": "get_bucket", | |
| "file": "src/api/middlewares/rate_limit.py", | |
| "lines": "133", | |
| "notes": "Same method as HistoryProvider: when creating a bucket, get_bucket (reached from dispatch at rate_limit.py:188) selects the policy per id type (ip_ -> ip_rate_limit, apikey_/user -> default_rate_limit, lines 138-147), which becomes the bucket capacity used by consume. Policy values configured at src/api/main.py:116-117 (100 / 30)." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "create_token", | |
| "file": "src/api/routers/tokens.py", | |
| "lines": "138", | |
| "notes": "Representative protected handler reached via call_next (rate_limit.py:225) after the Enforcer allows the request; POST /api/v1/tokens (router included at src/api/main.py:147) is the endpoint the SDK Entity calls via TokensAPI.create. All other /api/v1 routers are guarded the same way." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 2.99 kB
- Xet hash:
- 8487dd1954d6f8c8faf5fc91e6b91fe51b3b14548b702fa42bebe07fa4ffa173
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.