1 | import { RateLimiter } from "./types";
|
2 | export interface DefaultRateLimiterOptions {
|
3 | beta?: number;
|
4 | minCapacity?: number;
|
5 | minFillRate?: number;
|
6 | scaleConstant?: number;
|
7 | smooth?: number;
|
8 | }
|
9 | export declare class DefaultRateLimiter implements RateLimiter {
|
10 | private beta;
|
11 | private minCapacity;
|
12 | private minFillRate;
|
13 | private scaleConstant;
|
14 | private smooth;
|
15 | private currentCapacity;
|
16 | private enabled;
|
17 | private lastMaxRate;
|
18 | private measuredTxRate;
|
19 | private requestCount;
|
20 | private fillRate;
|
21 | private lastThrottleTime;
|
22 | private lastTimestamp;
|
23 | private lastTxRateBucket;
|
24 | private maxCapacity;
|
25 | private timeWindow;
|
26 | constructor(options?: DefaultRateLimiterOptions);
|
27 | private getCurrentTimeInSeconds;
|
28 | getSendToken(): Promise<void>;
|
29 | private acquireTokenBucket;
|
30 | private refillTokenBucket;
|
31 | updateClientSendingRate(response: any): void;
|
32 | private calculateTimeWindow;
|
33 | private cubicThrottle;
|
34 | private cubicSuccess;
|
35 | private enableTokenBucket;
|
36 | private updateTokenBucketRate;
|
37 | private updateMeasuredRate;
|
38 | private getPrecise;
|
39 | }
|