perf(sync): 通过写入日志恢复流式传输持久载荷

This commit is contained in:
2026-09-09 06:05:10 +08:00
parent 6e261aa7e1
commit b15e7a10a2
4 changed files with 321 additions and 30 deletions
+7 -11
View File
@@ -290,7 +290,7 @@ impl Workspace {
let path = local_path.as_deref().unwrap_or(&revision.path);
let local = self.resolve(path)?;
let current = if local.is_file() {
hash(&fs::read(&local)?)
crate::payloads::hash_file(&local)?
} else {
String::new()
};
@@ -329,18 +329,14 @@ impl Workspace {
"remote",
)?;
}
let content = fs::read(
self.sync_spool(
revision
.hash
.as_deref()
.ok_or_else(|| HostError::new("SYNC_RESPONSE_INVALID"))?,
)?,
)?;
self.write_with_identity(
let digest = revision
.hash
.as_deref()
.ok_or_else(|| HostError::new("SYNC_RESPONSE_INVALID"))?;
self.write_spooled_with_identity(
&revision.path,
&current,
&content,
(digest, revision.size as u64),
"remote",
&operation_id,
Some(&revision.file_id),