feat(downloads): 下载器单独的水位与保种天数
- contracts DownloaderPolicy(存 downloader_instance.settings.policy):硬阈值 / 恢复水位 / 清理目标 / 保种天数, 不填用全局 cache / retention - volumeThresholds:卷的生效水位 = 各实例「自己的值 ?? 全局」取最小;decideVolume、阈值清理、手动恢复、 首页卷信息、定时清理检查都改用它;cleanupCandidates 保种天数按实例 - 保存时校验合并全局后 恢复 < 硬阈值、清理目标 ≤ 恢复 - 下载器设置表单新增四项(留空用全局) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ff79554a09
commit
ee128e0b3f
9 files changed
+158
-14
No files matched your search
@@ -57,6 +57,21 @@ export type DownloaderKind = z.infer<typeof DownloaderKind>;
|
||||
export const DownloaderAuthKind = z.enum(["password", "api_key", "none"]);
|
||||
export type DownloaderAuthKind = z.infer<typeof DownloaderAuthKind>;
|
||||
|
||||
/**
|
||||
* 下载器自己的水位与保种(存 settings.policy,不填的项用全局「缓存」「保留」设置)。
|
||||
* 多个实例共用一个缓存卷时取各实例生效值里最严格的(硬阈值 / 恢复水位 / 清理目标都取最小)。
|
||||
* 公网 BT 专用的 qB 可以单独设,例如保种 0 天 = 入库后即可清理。
|
||||
*/
|
||||
export const DownloaderPolicy = z
|
||||
.object({
|
||||
hardThresholdPercent: z.number().min(1).max(100).optional(),
|
||||
resumePercent: z.number().min(1).max(100).optional(),
|
||||
cleanupTargetPercent: z.number().min(1).max(100).optional(),
|
||||
seedRetentionDays: z.number().int().min(0).max(365).optional(),
|
||||
})
|
||||
.strict();
|
||||
export type DownloaderPolicy = z.infer<typeof DownloaderPolicy>;
|
||||
|
||||
export const DownloaderInstance = EntityBase.extend({
|
||||
name: z.string().min(1),
|
||||
kind: DownloaderKind,
|
||||
|
||||
Reference in new issue
Block a user