feat(backup): GFS 分层保留策略(祖父-父-子)+ 任务表单配置#85
Merged
Merged
Conversation
新增企业级 GFS 保留:按天/周/月/年分层,每个周期保留最新一份,各层级取并集。 任一层级 > 0 即启用 GFS,取代 RetentionDays/MaxBackups 简单策略;全为 0 维持原 策略(向后兼容)。保留锁定(法律保留)记录始终豁免。 - model.BackupTask +KeepDaily/Weekly/Monthly/Yearly(AutoMigrate 自动加列,默认 0)。 - retention:gfsEnabled + selectGFSToDelete(按时间降序分桶、每桶留最新、层级并集、 排除锁定);Cleanup 按是否启用 GFS 分流。 - 任务创建/更新输入、写入与摘要输出贯通四个字段。 - 测试:日层级仅留当日代表且只留最近 N 天、层级并集(月度救回日度会删的旧备份)、 锁定豁免、gfsEnabled 判定。
备份任务表单的保留区新增 GFS 配置(日/周/月/年四个数字输入,任一 > 0 即启用, 覆盖天数/份数);types、draft 默认值、初值回填与提交载荷贯通 keepDaily/keepWeekly/keepMonthly/keepYearly。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景(丰富核心备份功能)
继保留锁定(#84)之后,补上备份产品的旗舰级保留策略 GFS(grandfather-father-son):按天/周/月/年分层保留,兼顾近期细粒度与长期低频留存——企业备份的标准能力。
行为
RetentionDays/MaxBackups简单策略;全为 0 维持原策略(向后兼容,既有任务零影响)。后端
model.BackupTask+KeepDaily/Weekly/Monthly/Yearly(AutoMigrate 自动加列,默认 0)。retention:gfsEnabled+selectGFSToDelete(按时间降序分桶、每桶留最新、层级并集、排除锁定);Cleanup按是否启用 GFS 分流。前端
测试
gfsEnabled判定。go test ./...全绿;前端tsc + vite build通过。