feat(backup): 新增备份内容浏览#90
Merged
Merged
Conversation
可查看每次备份实际捕获了哪些文件(路径、大小、目录),用于核对备份完整性、 排查遗漏,无需下载/解压归档——清单直接取自全量备份记录,秒级展示并支持按路径筛选。 - service:BackupRecordService.ListContents 解析记录清单为内容视图; 差异记录回退到其基线全量清单;上限 1 万条并标记截断;无清单时给出明确提示 - http:GET /backup/records/:id/contents(只读,viewer 亦可访问) - 前端:备份记录详情新增「查看内容」,弹窗以可筛选表格展示文件清单 与差异备份的清单机制天然协同:所有文件类型的新全量备份均自动可浏览。 go test 通过;tsc --noEmit 通过。
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.
背景
此前只能整体下载或恢复一个备份,无法查看里面到底有哪些文件。运维常需核对「昨晚的备份是否真的包含 /etc/nginx」「某目录是否被排除规则误伤」,却没有手段——只能盲信。本 PR 补齐「浏览备份内容」这一基础能力。
实现(零额外开销)
直接复用差异备份新增的清单机制——所有文件类型的新全量备份都会记录条目清单(路径/大小/目录),因此浏览无需下载或解压归档,秒级返回。
BackupRecordService.ListContents:解析记录清单为内容视图;差异记录回退到其基线全量清单(近似展示恢复后结构);超 1 万条标记截断;无清单(老备份/数据库类型)时返回明确提示。GET /backup/records/:id/contents:只读,viewer 角色亦可访问。安全
只读、零文件系统写入;路径仅用于展示与前端筛选,不参与任何文件操作 → 无路径穿越/注入面。
测试
go test ./internal/service ./internal/http通过;tsc --noEmit通过说明