Skip to content

feat(protocol): implement incremental recursion file list exchange - #2551

Merged
oferchen merged 1 commit into
masterfrom
feat/incremental-recursion
Feb 28, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/incremental-recursion

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Implement INC_RECURSE (incremental recursion) for protocol 32 file list exchange
  • Sender partitions file list into per-directory segments sent in depth-first order with NDX_FLIST_OFFSET framing, terminated by NDX_FLIST_EOF
  • Receiver reconstructs the complete list by reading all sub-lists before the transfer loop
  • Contiguous NDX ranges (no gaps) so NDX = index directly after reordering

Changes

New files

  • crates/protocol/src/flist/segment.rs — FileListSegment and SegmentedFileList data structures with NDX lookup
  • crates/protocol/src/flist/dir_tree.rs — DirectoryTree for depth-first directory traversal (mirrors upstream add_dirs_to_tree())

Modified files

  • crates/protocol/src/flist/mod.rs — re-export new modules
  • crates/core/src/client/remote/daemon_transfer.rs — enable i (INC_RECURSE) in capability string -e.iLsfxCIvu
  • crates/transfer/src/lib.rs — compute allow_inc_recurse matching upstream compat.c:161-179
  • crates/transfer/src/generator.rs — partition file list, send sub-lists with NDX_FLIST_OFFSET framing, PendingSegment references file_list by range
  • crates/transfer/src/receiver.rs — receive_extra_file_lists() reads sub-lists and appends to file_list
  • crates/transfer/src/setup.rs — add allow_inc_recurse to ProtocolSetupConfig

Design decisions

  • Pre-transfer sub-list sending: All sub-lists sent before the transfer loop (not interleaved) since we eagerly scan. Simplifies receiver — no need to handle sub-lists during delta processing.
  • Reordered file_list: After partitioning, file_list is reordered so NDX = index with no mapping needed. Initial entries first, then sub-segments in depth-first order.
  • PendingSegment by range: References file_list entries by (flist_start, count) rather than cloning, avoiding double allocation.

Upstream Reference

  • flist.c:add_dirs_to_tree(), flist.c:send_extra_file_list(), flist.c:recv_file_list()
  • compat.c:161-179 set_allow_inc_recurse()
  • io.c:read_ndx_and_attrs() — NDX_FLIST_OFFSET detection

Test plan

  • cargo fmt --all -- --check — clean
  • cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings — clean
  • cargo nextest run -p transfer -p protocol --all-features — 5566 tests pass
  • cargo nextest run --workspace --all-features — all pass (except pre-existing flaky progress_reports_intermediate_updates)
  • CI: fmt+clippy, nextest (stable), Windows, macOS, Linux musl
  • Interop testing with upstream rsync 3.4.1 (INC_RECURSE negotiation)

Add INC_RECURSE support for protocol 32 segmented file list sending.
When negotiated, the sender partitions the file list into per-directory
segments sent in depth-first order with NDX_FLIST_OFFSET framing, and
the receiver reconstructs the complete list before the transfer loop.

- Add FileListSegment and SegmentedFileList data structures
- Add DirectoryTree for depth-first directory traversal
- Enable 'i' capability flag in daemon handshake
- Partition and reorder file list for contiguous NDX ranges
- Send sub-lists with NDX_FLIST_OFFSET framing + NDX_FLIST_EOF
- Receive and append sub-list entries on receiver side
- Compute allow_inc_recurse matching upstream compat.c:161-179
@github-actions github-actions Bot added the enhancement New feature or request label Feb 28, 2026
@oferchen
oferchen merged commit d9e15fe into master Feb 28, 2026
6 of 11 checks passed
@oferchen
oferchen deleted the feat/incremental-recursion branch February 28, 2026 12:26
oferchen added a commit that referenced this pull request May 1, 2026
…2551)

Add INC_RECURSE support for protocol 32 segmented file list sending.
When negotiated, the sender partitions the file list into per-directory
segments sent in depth-first order with NDX_FLIST_OFFSET framing, and
the receiver reconstructs the complete list before the transfer loop.

- Add FileListSegment and SegmentedFileList data structures
- Add DirectoryTree for depth-first directory traversal
- Enable 'i' capability flag in daemon handshake
- Partition and reorder file list for contiguous NDX ranges
- Send sub-lists with NDX_FLIST_OFFSET framing + NDX_FLIST_EOF
- Receive and append sub-list entries on receiver side
- Compute allow_inc_recurse matching upstream compat.c:161-179
oferchen added a commit that referenced this pull request May 5, 2026
…2551)

Add INC_RECURSE support for protocol 32 segmented file list sending.
When negotiated, the sender partitions the file list into per-directory
segments sent in depth-first order with NDX_FLIST_OFFSET framing, and
the receiver reconstructs the complete list before the transfer loop.

- Add FileListSegment and SegmentedFileList data structures
- Add DirectoryTree for depth-first directory traversal
- Enable 'i' capability flag in daemon handshake
- Partition and reorder file list for contiguous NDX ranges
- Send sub-lists with NDX_FLIST_OFFSET framing + NDX_FLIST_EOF
- Receive and append sub-list entries on receiver side
- Compute allow_inc_recurse matching upstream compat.c:161-179
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