/** * stores 域对外契约:通知历史 jsonl 与频道投递状态的**唯一持久化实现**——写队列串行化 + tmp+rename 原子写,读取语义 * (滚动上限、按天过滤、内存镜像优先)也由本域兜住。契约里没有任何句柄:外面拿不到实例就造不出第二份写队列。 */ import type { StoreDeps } from "./deps.js"; import type { ProducedReason } from "../shared/interface.js"; import type { ClearOutcome, HistoryEntry } from "./impl/history/type.js"; import type { ChannelStatusEntry } from "./impl/status/type.js"; export type { ChannelDelivery, HistoryEntry } from "./impl/history/type.js"; /** * 装配(组合根在 `apply` 期调用一次)。只交付外部数据与宿主能力,不返回任何句柄—— * 本域的状态由自己持有。 */ export declare function installStores(deps: StoreDeps): void; /** * 卸载两个存储,与 `installStores` 配对。写队列里在飞的写不等待:它们各有自己的失败出口, * 卸载期阻塞等待会让一次退出卡在磁盘上。重复调用无害。 */ export declare function releaseStores(): void; /** 写入:追加一条通知历史(内部队列串行化,失败只记日志)。 */ export declare function appendHistory(entry: HistoryEntry): void; /** 查询:读取通知历史(尾部截断 + 按天过滤 + 损坏行跳过由本域兜住)。 */ export declare function readHistory(): Promise; /** * 清空通知历史:返回被清空条数,落盘失败则给 `unavailable`。 * * 两态而不是裸条数(#1016 残留 1):条数只在真的清掉了时才是事实,返回裸条数会让端点把 * 「写失败了」也答成 200。失败态不带原因(Node 错误原文含 errno 与绝对路径),诊断走日志出口。 */ export declare function clearHistory(): Promise; /** 写入:记录一次频道投递终态(失败理由会落盘并被设置页读出,不要放凭据)。 */ export declare function recordStatus(channelId: string, status: "ok" | "failed", error?: ProducedReason, soundWarning?: ProducedReason): void; /** 查询:读取全部频道状态(内存镜像优先,冷启动回落文件)。 */ export declare function readStatus(): Promise>;