carbond.limiter.ChainLimiter¶
ChainLimiter
should be used to insert
series (or tree) of limiters at a given point in the
Endpoint
tree. A request will be evaluated by
each limiter in the chain in order with evaluation stopping at the first
limiter that rejects the request.
Class¶
-
class
carbond.limiter.
ChainLimiter
()¶ extends:
Limiter
- ¶
initialize Arguments - service (
Service
) – the rootService
instance - node (
carbond.Endpoint
) – theEndpoint
that we are attached to
Description Called on service initialization. Cascades initialization to all limiters managed by this instance. - service (
- ¶
process Arguments - req (
express.request
) – the currentRequest
object - res (
express.response
) – the currentResponse
object - next (
Function
) – continuation
Description Overrides process
to iterate overlimiters
callingprocess
on each individual limiter. If a limiter in the chain ends the request-response cycle, then subsequent limiters will not be evaluated. Similarly, if an error is passed tonext
, processing will stop and the error will be passed on to the appropriate error handling middleware.- req (