Documentation
¶
Index ¶
- func MustPreserveReplacementSource(err error) bool
- func Replace(sourcePath, targetPath string) error
- func ReplaceFile(sourcePath, targetPath string) error
- func ReplaceFileWithBackup(sourcePath, targetPath, _ string) error
- func SyncParentDirectory(path string) error
- type ReplacementSourcePreservationError
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustPreserveReplacementSource ¶
MustPreserveReplacementSource 报告 wrapped/joined error 是否要求调用方保留 source。
func ReplaceFile ¶
ReplaceFile 用源文件替换目标路径;调用方应确保源文件已完整写入并关闭。
func ReplaceFileWithBackup ¶
ReplaceFileWithBackup 与 Windows 的 API 形状一致;非 Windows 的 rename 已原子替换目标, 不会产生旧文件备份。
func SyncParentDirectory ¶
SyncParentDirectory 在替换提交后同步目标目录项。Windows 上由平台实现返回 可兑现的保证;调用方仍需处理返回的真实错误。
Types ¶
type ReplacementSourcePreservationError ¶
type ReplacementSourcePreservationError interface {
error
PreserveReplacementSource()
}
ReplacementSourcePreservationError 标记一次替换错误后的 source 仍是恢复材料。 调用方必须保留 source,直至人工或后续恢复流程完成。
type Result ¶
Result 描述 private-file 替换在返回错误时留下的文件状态。 Committed 表示 target 已经换成 source;PreserveSource 表示替换状态未决, source 仍是恢复材料,调用方不得将其当作普通失败临时文件删除。
func ReplacePrivateFile ¶
ReplacePrivateFile 使用本平台的 private-file 替换协议。