Skip to content

feat(engine): compute_extras for parallel deterministic delete (#2255) - #4262

Merged
oferchen merged 1 commit into
masterfrom
feat/compute-extras-2255
May 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/compute-extras-2255

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds compute_extras(dest_dir, segment_entries) -> io::Result<Vec<DeleteEntry>> in crates/engine/src/delete/extras.rs: phase 1 of the parallel-deterministic-delete pipeline (DDP-B1, Remove system rsync delegation for server mode #2255).
  • Pure function: lists the destination directory, set-subtracts basenames present in the flist segment, classifies survivors by kind (file/dir/symlink/device/special), returns unsorted extras for the caller to wrap in a DeletePlan, sort via DeletePlan::sort_by_name, and publish to DeletePlanMap.
  • Mirrors upstream rsync 3.4.1 generator.c:272-347 (delete_in_dir) basename-keyed lookup against the active flist via flist_find_ignore_dirness.
  • Hardlink-cohort plumbing is deferred to DDP-D2; entries here always carry hardlink_cohort: None.

Implementation Notes

  • Symlinks use fs::symlink_metadata so they classify as DeleteEntryKind::Symlink rather than the link target's type.
  • Device/FIFO/socket detection is gated to cfg(unix) via FileTypeExt; on Windows non-dir, non-symlink entries fall through to DeleteEntryKind::File matching upstream's "anything else counts as a regular deletion" fallback.
  • Segment entries whose path has no leaf component are skipped from the basename set (they cannot collide with a real on-disk entry and upstream's flist_find would not match them either).
  • The returned Vec is intentionally unsorted; ordering is the caller's responsibility via DeletePlan::sort_by_name.

Test Plan

  • cargo fmt --all
  • CI: fmt + clippy, nextest (stable), Windows (stable), macOS (stable), Linux musl (stable)

Tests added in extras.rs:

  • empty_dest_and_empty_segment_yields_no_extras
  • entries_present_in_segment_are_excluded
  • segment_with_full_paths_still_matches_on_basename
  • dest_only_entries_all_become_extras
  • classifies_regular_file_directory_and_symlink
  • classifies_fifo_as_special (Unix-only, mkfifo)
  • nonexistent_dest_returns_not_found
  • results_are_deterministic_set_across_runs
  • ignores_segment_entries_with_empty_path

Phase 1 of the parallel-deterministic-delete pipeline: a pure function
that lists a destination directory, set-subtracts entries present in
the corresponding flist segment, and classifies surviving entries by
kind so the caller can wrap them in a DeletePlan, sort to upstream
emission order, and publish to the DeletePlanMap.

Mirrors upstream rsync 3.4.1 generator.c:272-347 (delete_in_dir)
basename-keyed set subtraction against the active flist via
flist_find_ignore_dirness. Symlinks classify by symlink_metadata so
they map to DeleteEntryKind::Symlink instead of the link target type.
Hardlink-cohort tagging is left to task DDP-D2; entries here always
carry hardlink_cohort: None.

Cross-platform: device/FIFO/socket classification gated to Unix via
FileTypeExt; on Windows non-dir, non-symlink entries collapse to
DeleteEntryKind::File matching upstream's fallback behaviour.
@oferchen
oferchen merged commit 8b08138 into master May 17, 2026
12 of 13 checks passed
@github-actions github-actions Bot added the enhancement New feature or request label May 17, 2026
oferchen added a commit that referenced this pull request May 18, 2026
#4262)

Phase 1 of the parallel-deterministic-delete pipeline: a pure function
that lists a destination directory, set-subtracts entries present in
the corresponding flist segment, and classifies surviving entries by
kind so the caller can wrap them in a DeletePlan, sort to upstream
emission order, and publish to the DeletePlanMap.

Mirrors upstream rsync 3.4.1 generator.c:272-347 (delete_in_dir)
basename-keyed set subtraction against the active flist via
flist_find_ignore_dirness. Symlinks classify by symlink_metadata so
they map to DeleteEntryKind::Symlink instead of the link target type.
Hardlink-cohort tagging is left to task DDP-D2; entries here always
carry hardlink_cohort: None.

Cross-platform: device/FIFO/socket classification gated to Unix via
FileTypeExt; on Windows non-dir, non-symlink entries collapse to
DeleteEntryKind::File matching upstream's fallback behaviour.
oferchen added a commit that referenced this pull request May 18, 2026
#4262)

Phase 1 of the parallel-deterministic-delete pipeline: a pure function
that lists a destination directory, set-subtracts entries present in
the corresponding flist segment, and classifies surviving entries by
kind so the caller can wrap them in a DeletePlan, sort to upstream
emission order, and publish to the DeletePlanMap.

Mirrors upstream rsync 3.4.1 generator.c:272-347 (delete_in_dir)
basename-keyed set subtraction against the active flist via
flist_find_ignore_dirness. Symlinks classify by symlink_metadata so
they map to DeleteEntryKind::Symlink instead of the link target type.
Hardlink-cohort tagging is left to task DDP-D2; entries here always
carry hardlink_cohort: None.

Cross-platform: device/FIFO/socket classification gated to Unix via
FileTypeExt; on Windows non-dir, non-symlink entries collapse to
DeleteEntryKind::File matching upstream's fallback behaviour.
@oferchen
oferchen deleted the feat/compute-extras-2255 branch May 19, 2026 19:28
oferchen added a commit that referenced this pull request Aug 24, 2026
#4262)

Phase 1 of the parallel-deterministic-delete pipeline: a pure function
that lists a destination directory, set-subtracts entries present in
the corresponding flist segment, and classifies surviving entries by
kind so the caller can wrap them in a DeletePlan, sort to upstream
emission order, and publish to the DeletePlanMap.

Mirrors upstream rsync 3.4.1 generator.c:272-347 (delete_in_dir)
basename-keyed set subtraction against the active flist via
flist_find_ignore_dirness. Symlinks classify by symlink_metadata so
they map to DeleteEntryKind::Symlink instead of the link target type.
Hardlink-cohort tagging is left to task DDP-D2; entries here always
carry hardlink_cohort: None.

Cross-platform: device/FIFO/socket classification gated to Unix via
FileTypeExt; on Windows non-dir, non-symlink entries collapse to
DeleteEntryKind::File matching upstream's fallback behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant