/** * [ref] 批1 —— 限额座的**换代同步口**([ref] §2 B簇1)。 * * `applyEffective` 的 commit 段只做一件事:把新值写进 `config`。两只限额座(RateGate / QuotaTracker)持有的 * 是**比较参数**,不是 config 引用,所以它们要在 commit 之后被推一把 —— 与 `pricing` / `keyResolver` 那两件 * 派生重建同族、同纪律(commit 之后、**零 await 之内**;源锚在 test/config-hot/batch1-limits-hot.test.ts)。 * * 为什么不是「座位每次 check 现读 config」:那样每个请求都要过一次配置对象取值,而且会把「限额座」这个 * 概念稀释成一堆散落的读点(六个实现类各读各的)。setter 形让 0↔N、N→N′ 全部收敛成一次显式换代,并且 * 关断哨兵可以顺手把 SQL 腿的刷新环真的停掉(off 态零 SQL 的承诺就落在这里)。 */ import type { ServiceConfig } from "../config-types.js"; import type { QuotaLimits, QuotaTracker } from "../observability/cost-quota.js"; import type { Logger } from "../observability/logger.js"; import type { RateGate } from "../observability/rate-limit.js"; /** USD/秒 → micro/ms 的**唯一**换算点(装配期构造与热同步共用;两处各算一次迟早会差一个 1e6)。 */ export declare function buildQuotaBounds(config: Pick): QuotaLimits; export interface LimitSyncCtx { /** 活配置(热应用就地改写的**同一个**对象)。 */ readonly config: Pick; /** 恒构造的两只座;undefined 只出现在「这条腿本部署根本没装配」的夹具形。 */ readonly rateGate?: RateGate; readonly quota?: QuotaTracker; readonly logger?: Logger; } export interface LimitSync { /** 把两只座推到 config 现值。幂等;**只在真变了的时候**留一行(refresh 每分钟一拍,恒打就是噪音)。 */ sync(): void; } /** `create*`:返回带行为的活对象(闭包持座 + 上一代读数)。 */ export declare function createLimitSync(ctx: LimitSyncCtx): LimitSync; //# sourceMappingURL=limit-sync.d.ts.map