Skip to content

feat(transfer): add async transfer pipeline with tokio channels - #2518

Merged
oferchen merged 1 commit into
masterfrom
feat/async-transfer-pipeline
Feb 27, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/async-transfer-pipeline

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Add async feature flag to the transfer crate with tokio/tokio-util optional dependencies
  • Introduce FileList (Arc-shared immutable file list), FileJob (dispatch unit with retry support), and AsyncPipelineConfig types
  • Implement tokio-based producer/consumer pipeline with bounded mpsc channels for backpressure
  • Pipeline supports cooperative cancellation via CancellationToken, atomic progress counters, and two-phase retry (local VecDeque after initial pass)
  • Wire transfer/async through core's async feature gate

Architecture

run_pipeline(config, file_list, dest_dir, process_fn)
  ├── Producer task (tokio::spawn)
  │     FileList → FileJob → mpsc::Sender.send().await
  │     (bounded channel capacity for backpressure)
  │
  └── Consumer loop
        mpsc::Receiver.recv().await → process_fn(job).await
        Phase 1: process channel jobs
        Phase 2: process retry queue (local VecDeque)

New Files

  • crates/transfer/src/pipeline/job.rs — FileList, FileJob, TransferFlags
  • crates/transfer/src/pipeline/async_dispatch.rs — produce_file_jobs() producer
  • crates/transfer/src/pipeline/async_pipeline.rs — run_pipeline(), PipelineHandle, TransferOutcome

Test Plan

  • 16 new async tests covering empty lists, all-file transfers, skipped files, permanent errors, retryable errors with exhaustion, retry disabled, cancellation, progress counters, mixed outcomes
  • 980 tests pass with --features async
  • 964 tests pass without async feature (backward compat)
  • cargo fmt --all -- --check clean
  • cargo clippy -p transfer --features async --no-deps clean (pre-existing token_reader.rs large_enum_variant only)

@github-actions github-actions Bot added the enhancement New feature or request label Feb 27, 2026
@oferchen
oferchen force-pushed the feat/async-transfer-pipeline branch from 4980324 to 95ebf77 Compare February 27, 2026 09:27
Add feature-gated async pipeline infrastructure behind `async` feature
flag. Introduces FileList (Arc-shared immutable file list), FileJob
(dispatch unit with retry support), and a tokio producer/consumer
pipeline with bounded mpsc channels for backpressure control.
@oferchen
oferchen force-pushed the feat/async-transfer-pipeline branch from 299bd39 to 2baca27 Compare February 27, 2026 09:34
@oferchen
oferchen merged commit baf4dda into master Feb 27, 2026
30 checks passed
@oferchen
oferchen deleted the feat/async-transfer-pipeline branch February 27, 2026 09:45
oferchen added a commit that referenced this pull request May 1, 2026
feat(transfer): add async transfer pipeline with tokio channels
oferchen added a commit that referenced this pull request May 5, 2026
feat(transfer): add async transfer pipeline with tokio channels
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