feat: 解决 CDC 去重、集中备份与首次初始化问题 - #105
Draft
Awuqing wants to merge 4 commits into
Draft
Conversation
使用内容定义分块、不可变 pack 与快照索引实现跨文件和跨快照去重。 接入多目标上传、软配额、恢复、下载、校验、保留和安全垃圾回收,并补充前端入口、中英文文档及端到端测试。 Closes #94
为 Master 本地磁盘增加可选流式中转,远程 Agent 可直接把产物写入中央存储并通过反向通道恢复。 持久化并校验传输模式,兼容既有 Agent 本机磁盘目标,补齐鉴权、完整性、配额、访问保护、前端配置及双向链路测试。 Closes #101
在登录和首个管理员创建前提供中英文切换,并在初始化状态不可达时展示可重试错误,避免误入登录页。 对齐源码构建产物与安装脚本路径,增加 systemd/API 就绪检查、失败诊断及中英文裸机文档。 Closes #104
建立本地图标出口,统一项目内 Arco SVG 图标依赖并抽取登录页服务器插画。 以可复用的存储目标名称组件替换字符星标,补充可访问语义与组件测试。
| if !filepath.IsAbs(targetRoot) { | ||
| return fmt.Errorf("repository restore target must be absolute: %s", targetRoot) | ||
| } | ||
| if err := os.MkdirAll(targetRoot, 0o755); err != nil { |
| } | ||
| switch entry.Kind { | ||
| case "directory": | ||
| if info, statErr := os.Lstat(targetPath); statErr == nil { |
| } else if !errors.Is(statErr, os.ErrNotExist) { | ||
| return fmt.Errorf("inspect restore directory %s: %w", targetPath, statErr) | ||
| } | ||
| if err := os.MkdirAll(targetPath, os.FileMode(entry.Mode)); err != nil { |
| } | ||
| directories = append(directories, entry) | ||
| case "symlink": | ||
| if err := os.RemoveAll(targetPath); err != nil { |
| if err := os.RemoveAll(targetPath); err != nil { | ||
| return fmt.Errorf("replace restore symlink %s: %w", targetPath, err) | ||
| } | ||
| if err := os.Symlink(entry.LinkTarget, targetPath); err != nil { |
| } | ||
| if entry.Kind == "file" { | ||
| modTime := time.Unix(0, entry.ModTime) | ||
| if err := os.Chtimes(targetPath, modTime, modTime); err != nil { |
| if !ok { | ||
| return fmt.Errorf("unsafe repository restore path %q", entry.Path) | ||
| } | ||
| if err := os.Chmod(targetPath, os.FileMode(entry.Mode)); err != nil { |
| return fmt.Errorf("restore mode for %s: %w", targetPath, err) | ||
| } | ||
| modTime := time.Unix(0, entry.ModTime) | ||
| if err := os.Chtimes(targetPath, modTime, modTime); err != nil { |
| } | ||
| for _, segment := range strings.Split(relative, string(filepath.Separator)) { | ||
| current = filepath.Join(current, segment) | ||
| info, statErr := os.Lstat(current) |
| current = filepath.Join(current, segment) | ||
| info, statErr := os.Lstat(current) | ||
| if errors.Is(statErr, os.ErrNotExist) { | ||
| if err := os.Mkdir(current, 0o755); err != nil && !errors.Is(err, os.ErrExist) { |
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.
变更概览
兼容性与安全
masterRelay的本地磁盘目标继续保持 Agent 本机存储语义。验证
go test ./...go vet ./...npm test -- --run:13 个测试文件、28 个用例通过npm run buildsh -n deploy/install.sh