carbond.limiter.PolicyLimiter¶
PolicyLimiter allows you to specify a policy (see:
LimiterPolicy) and a mechanism to group requests
(see LimiterSelector) to be evaluated by the policy.
Class¶
-
class
carbond.limiter.PolicyLimiter()¶ extends:
Limiter- ¶
selector Required Description The selector used to group incoming requests.
- ¶
policy Required Description The policy used to evaluate incoming requests.
- ¶
initialize Arguments - service (
Service) – the rootServiceinstance - node (
carbond.Endpoint) – theEndpointthat we are attached to
Description Extends carbond.limiter.Limiter.initializeto initialize the policy and policy state.- service (
- ¶
process Arguments - req (
express.request) – the currentRequestobject - res (
express.response) – the currentResponseobject - next (
Function) – continuation
Description Implements carbond.limiter.Limiter.processto applypolicyusing the grouping generated byselectorand, finally, passing the request on if the policy allows or sending a503response if not.- req (
- ¶
class method
Reset the state across all policies.