/** * Cross-replica per-key CUMULATIVE cost quota ([ref] P0-1). A thin {@link QuotaTracker} over the * shared {@link WriteBehindCounter}: atomic write-behind aggregation, eventually consistent (SOFT * limiting — boundary overspend is bounded by the flush interval and backstopped by the HARD per-task * `maxCostUsd` gate). `scope_key` is opaque (principal today; team/feature later — [ref] N3). */ import type { Pool } from "mysql2/promise"; import type { QuotaDecision, QuotaLimits, QuotaTracker } from "../observability/cost-quota.js"; import { type CounterDegradeHook } from "./write-behind-counter.js"; export declare class TiDBCostQuota implements QuotaTracker { private readonly counter; /** [ref]:限额=比较参数(行里只有花费);窗长换代经 counter.setWindowMs(桶键语义见那里)。 */ private limitMicroUsd; private refreshRequested; private refreshIntervalMs; constructor(pool: Pool, limitMicroUsd: number, windowMs: number, now?: () => number, onDegraded?: CounterDegradeHook, queryTimeoutMs?: number); setLimits(next: QuotaLimits): void; private syncRefresh; check(scopeKey: string): QuotaDecision; add(scopeKey: string, micro: number): void; flush(): Promise; refresh(): Promise; reap(): Promise; startRefresh(intervalMs?: number): this; stop(): void; } //# sourceMappingURL=tidb-cost-quota.d.ts.map