跳转到内容

SegmentedStorePolicy

分层存储策略:冷层编码、热盘保留、上传并发 / 重试预算、载入预取与流变换。

optional codec?: SegmentCodec;

冷层封存段编码;缺省 ‘jsonl+gzip’(zstd 仅 Node ≥ 22.15 可用)


optional hotRetention?: {
keepRecentSegments?: number;
maxBytes?: number;
};

热盘保留:触顶 → store.hot_full 事件 + readiness 红;恒不删未上传段

optional keepRecentSegments?: number;
optional maxBytes?: number;

optional keyMapper?: (canonicalKey) => string;

规范键 → 适配器键(不得破坏唯一性)

string

string


optional restore?: {
prefetchTailSegments?: number;
};

载入:缺省只预取 1 个尾段(压缩后通常 = 摘要 + 尾段)

optional prefetchTailSegments?: number;

optional tenant?: string;

规范键首段;缺省 ‘default’


optional transform?: StreamTransform;

optional upload?: {
concurrency?: number;
mode?: "async" | "sync";
retryBudget?: {
attempts: number;
maxBackoffMs: number;
};
};

上传:缺省 async / 并发 4 / 重试预算 8 次、退避封顶 60 s

optional concurrency?: number;
optional mode?: "async" | "sync";
optional retryBudget?: {
attempts: number;
maxBackoffMs: number;
};
attempts: number;
maxBackoffMs: number;