/**
 * @module RateLimiter
 */
import { type BackoffPolicy } from "../../../../backoff-policies/contracts/_module.js";
import { type IReadableContext } from "../../../../execution-context/contracts/_module.js";
import { type IRateLimiterStorageAdapter } from "../../../../rate-limiter/contracts/_module.js";
import { type AllRateLimiterState, type InternalRateLimiterPolicy } from "../../../../rate-limiter/implementations/adapters/database-rate-limiter-adapter/internal-rate-limiter-policy.js";
import { type InvokableFn } from "../../../../utilities/_module.js";
/**
 * @internal
 */
export type RateLimiterStorageSettings<TMetrics> = {
    adapter: IRateLimiterStorageAdapter<AllRateLimiterState<TMetrics>>;
    rateLimiterPolicy: InternalRateLimiterPolicy<TMetrics>;
    backoffPolicy: BackoffPolicy;
};
/**
 * @internal
 */
export type IRateLimiterStorageState = {
    success: boolean;
    attempt: number;
    resetTime: Date;
};
/**
 * @internal
 */
export type AtomicUpdateArgs<TMetrics> = {
    context: IReadableContext;
    key: string;
    update: InvokableFn<[
        currentState: AllRateLimiterState<TMetrics>
    ], AllRateLimiterState<TMetrics>>;
};
/**
 * @internal
 */
export declare class RateLimiterStorage<TMetrics = unknown> {
    private readonly adapter;
    private readonly rateLimiterPolicy;
    private readonly backoffPolicy;
    constructor(settings: RateLimiterStorageSettings<TMetrics>);
    private static resolveStorageData;
    private toAdapterState;
    atomicUpdate(args: AtomicUpdateArgs<TMetrics>): Promise<IRateLimiterStorageState>;
    find(context: IReadableContext, key: string): Promise<IRateLimiterStorageState | null>;
    remove(context: IReadableContext, key: string): Promise<void>;
}
