20260407 & 20260408 基于cir 三方replay对齐,并且materialize 使用hard link优化

This commit is contained in:
2026-04-08 16:27:46 +08:00
parent 34fb9657f1
commit c9ef5aaf4c
36 changed files with 8743 additions and 31 deletions

View File

@@ -98,7 +98,8 @@ impl SystemRsyncFetcher {
}
fn module_fetch_uri(&self, rsync_base_uri: &str) -> String {
rsync_capture_scope_uri(rsync_base_uri).unwrap_or_else(|| normalize_rsync_base_uri(rsync_base_uri))
rsync_module_root_uri(rsync_base_uri)
.unwrap_or_else(|| normalize_rsync_base_uri(rsync_base_uri))
}
}
@@ -171,7 +172,7 @@ impl Drop for TempDir {
}
}
fn rsync_capture_scope_uri(s: &str) -> Option<String> {
fn rsync_module_root_uri(s: &str) -> Option<String> {
let normalized = normalize_rsync_base_uri(s);
let rest = normalized.strip_prefix("rsync://")?;
let mut host_and_path = rest.splitn(2, '/');
@@ -181,10 +182,8 @@ fn rsync_capture_scope_uri(s: &str) -> Option<String> {
if segments.is_empty() {
return None;
}
if segments.len() >= 4 {
segments.pop();
}
Some(format!("rsync://{authority}/{}/", segments.join("/")))
let module = segments.remove(0);
Some(format!("rsync://{authority}/{module}/"))
}
fn walk_dir_collect(
@@ -283,28 +282,28 @@ mod tests {
}
#[test]
fn rsync_capture_scope_uri_widens_only_deep_publication_points() {
fn rsync_module_root_uri_returns_host_and_module_only() {
assert_eq!(
rsync_capture_scope_uri("rsync://example.net/repo/ta/ca/publication-point/"),
Some("rsync://example.net/repo/ta/ca/".to_string())
);
assert_eq!(
rsync_capture_scope_uri("rsync://example.net/repo/ta/"),
Some("rsync://example.net/repo/ta/".to_string())
);
assert_eq!(
rsync_capture_scope_uri("rsync://example.net/repo/"),
rsync_module_root_uri("rsync://example.net/repo/ta/ca/publication-point/"),
Some("rsync://example.net/repo/".to_string())
);
assert_eq!(rsync_capture_scope_uri("https://example.net/repo"), None);
assert_eq!(
rsync_module_root_uri("rsync://example.net/repo/ta/"),
Some("rsync://example.net/repo/".to_string())
);
assert_eq!(
rsync_module_root_uri("rsync://example.net/repo/"),
Some("rsync://example.net/repo/".to_string())
);
assert_eq!(rsync_module_root_uri("https://example.net/repo"), None);
}
#[test]
fn system_rsync_dedup_key_uses_capture_scope() {
fn system_rsync_dedup_key_uses_module_root() {
let fetcher = SystemRsyncFetcher::new(SystemRsyncConfig::default());
assert_eq!(
fetcher.dedup_key("rsync://example.net/repo/ta/ca/publication-point/"),
"rsync://example.net/repo/ta/ca/"
"rsync://example.net/repo/"
);
}