fix(sync): (Codex) 为云同步上传补充 modifiedDate (写入 S3 自定义元数据)#1408
Open
cyfung1031 wants to merge 2 commits intomainfrom
Open
fix(sync): (Codex) 为云同步上传补充 modifiedDate (写入 S3 自定义元数据)#1408cyfung1031 wants to merge 2 commits intomainfrom
cyfung1031 wants to merge 2 commits intomainfrom
Conversation
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.
背景
S3 writer 已经支持
FileCreateOptions.modifiedDate,并会将该时间写入 S3 自定义元数据。但 cloud sync 的上传路径此前没有传递modifiedDate,导致脚本文件、meta 文件、同步状态文件以及删除 tombstone 在 S3 场景下无法写入对应的时间元数据。本 PR 补齐 cloud sync 到 filesystem writer 的时间传递,让现有 S3 元数据写入能力在同步上传路径中生效。
改动内容
.user.js时传入脚本文件时间。.meta.json时使用与.user.js相同的脚本文件时间。scriptcat-sync.json时传入当前同步状态写入时间。.meta.json时传入当前删除标记写入时间。getScriptModifiedDate(),集中脚本文件时间选择逻辑:script.updatetimescript.createtimeDate.now()x-amz-meta-createtime写入补充兼容性注释,说明该字段实际来源是FileCreateOptions.modifiedDate。modifiedDate会被正确传递和写入。设计说明
.user.js和.meta.json描述的是同一个脚本实体,同步比较也基于脚本更新时间,因此两者使用同一个modifiedDate更稳定。scriptcat-sync.json表示本次同步状态写入,删除 tombstone 表示本次删除标记写入,因此两者使用写入当下的时间。S3 侧本次继续写入历史兼容字段
x-amz-meta-createtime,不改为x-amz-meta-modifiedtime。直接改名可能影响已有对象或旧客户端;如果后续需要让 S3 metadata 参与同步判断,应另开 PR 设计读取策略、双写迁移和兼容逻辑。非目标
x-amz-meta-modifiedtime。