/** A sustained rate and the burst above it one gateway admits, per process. */ export interface RateLimit { readonly requestsPerSecond: number; readonly burst: number; } /** What a hosted gateway admits when its operator named no limit. */ export declare const HOSTED_DEFAULT_RATE_LIMIT: RateLimit; /** The result of one take: admitted, or refused with how long until a request would be. */ export type RateDecision = { readonly admitted: true; } | { readonly admitted: false; readonly retryAfterSeconds: number; }; /** * A token bucket: `burst` tokens to start, refilled at `requestsPerSecond`, * one taken per request. Time comes from the clock it is given. A clock * that steps backwards refills nothing and moves the baseline with it, so a * change of system time neither grants a burst nor stalls the bucket. */ export declare class TokenBucket { private readonly limit; private readonly clock; private tokens; private last; constructor(limit: RateLimit, clock: () => number); take(): RateDecision; } //# sourceMappingURL=RateLimit.d.ts.map