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 rootService
instance - node (
carbond.Endpoint
) – theEndpoint
that we are attached to
Description Extends carbond.limiter.Limiter.initialize
to initialize the policy and policy state.- service (
- ¶
process Arguments - req (
express.request
) – the currentRequest
object - res (
express.response
) – the currentResponse
object - next (
Function
) – continuation
Description Implements carbond.limiter.Limiter.process
to applypolicy
using the grouping generated byselector
and, finally, passing the request on if the policy allows or sending a503
response if not.- req (
- ¶
class method
Reset the state across all policies.