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 rootServiceinstance - node (
carbond.Endpoint) – theEndpointthat 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 currentRequestobject - res (
express.response) – the currentResponseobject - next (
Function) – continuation
Description Overrides processto iterate overlimiterscallingprocesson 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 (