Repository navigation
feat(rsync_io): sync/async bridge for embedded SSH streams (#1806) - #4295
Merged
Merged
Conversation
Adds the bridge primitives that let the existing synchronous multiplex and transfer code drive an async russh channel without being ported to async. Builds on PR #4290 (#1805) which wired the async SshTransport into the client driver via the OC_RSYNC_ASYNC_SSH env var. The new `ssh::embedded::sync_bridge` module is gated under `embedded-ssh` and exposes: - `SyncAsyncBridge<S>`: a generic facade that takes any `AsyncRead + AsyncWrite + Unpin + Send + 'static` stream (including russh's `ChannelStream`) and exposes `std::io::Read + std::io::Write` by driving an internal current-thread tokio runtime via `block_on`. - `into_sync_halves(russh::Channel)` returning `(SyncReader, SyncWriter)` halves backed by a background pump task and bounded `std::sync::mpsc` / `tokio::sync::mpsc` queues - the inverse of the existing `ChannelReader`/`ChannelWriter` adapters in `channel_adapter.rs`. - `into_sync_halves_with_capacity` for callers that need a different queue depth (used by the backpressure test).
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…4295) Adds the bridge primitives that let the existing synchronous multiplex and transfer code drive an async russh channel without being ported to async. Builds on PR #4290 (#1805) which wired the async SshTransport into the client driver via the OC_RSYNC_ASYNC_SSH env var. The new `ssh::embedded::sync_bridge` module is gated under `embedded-ssh` and exposes: - `SyncAsyncBridge<S>`: a generic facade that takes any `AsyncRead + AsyncWrite + Unpin + Send + 'static` stream (including russh's `ChannelStream`) and exposes `std::io::Read + std::io::Write` by driving an internal current-thread tokio runtime via `block_on`. - `into_sync_halves(russh::Channel)` returning `(SyncReader, SyncWriter)` halves backed by a background pump task and bounded `std::sync::mpsc` / `tokio::sync::mpsc` queues - the inverse of the existing `ChannelReader`/`ChannelWriter` adapters in `channel_adapter.rs`. - `into_sync_halves_with_capacity` for callers that need a different queue depth (used by the backpressure test).
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…4295) Adds the bridge primitives that let the existing synchronous multiplex and transfer code drive an async russh channel without being ported to async. Builds on PR #4290 (#1805) which wired the async SshTransport into the client driver via the OC_RSYNC_ASYNC_SSH env var. The new `ssh::embedded::sync_bridge` module is gated under `embedded-ssh` and exposes: - `SyncAsyncBridge<S>`: a generic facade that takes any `AsyncRead + AsyncWrite + Unpin + Send + 'static` stream (including russh's `ChannelStream`) and exposes `std::io::Read + std::io::Write` by driving an internal current-thread tokio runtime via `block_on`. - `into_sync_halves(russh::Channel)` returning `(SyncReader, SyncWriter)` halves backed by a background pump task and bounded `std::sync::mpsc` / `tokio::sync::mpsc` queues - the inverse of the existing `ChannelReader`/`ChannelWriter` adapters in `channel_adapter.rs`. - `into_sync_halves_with_capacity` for callers that need a different queue depth (used by the backpressure test).
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…4295) Adds the bridge primitives that let the existing synchronous multiplex and transfer code drive an async russh channel without being ported to async. Builds on PR #4290 (#1805) which wired the async SshTransport into the client driver via the OC_RSYNC_ASYNC_SSH env var. The new `ssh::embedded::sync_bridge` module is gated under `embedded-ssh` and exposes: - `SyncAsyncBridge<S>`: a generic facade that takes any `AsyncRead + AsyncWrite + Unpin + Send + 'static` stream (including russh's `ChannelStream`) and exposes `std::io::Read + std::io::Write` by driving an internal current-thread tokio runtime via `block_on`. - `into_sync_halves(russh::Channel)` returning `(SyncReader, SyncWriter)` halves backed by a background pump task and bounded `std::sync::mpsc` / `tokio::sync::mpsc` queues - the inverse of the existing `ChannelReader`/`ChannelWriter` adapters in `channel_adapter.rs`. - `into_sync_halves_with_capacity` for callers that need a different queue depth (used by the backpressure test).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ssh::embedded::sync_bridge(gatedembedded-ssh) with two complementary bridge primitives that let the existing sync multiplex and transfer code drive an async russh-backed stream:SyncAsyncBridge<S>wraps anyAsyncRead + AsyncWrite + Unpin + Send + 'static(including russh'sChannelStream) and exposesstd::io::Read + std::io::Writeby driving an internal current-thread tokio runtime viablock_on.into_sync_halves(russh::Channel) -> (SyncReader, SyncWriter)returns halves backed by a background pump task and boundedstd::sync::mpsc/tokio::sync::mpscqueues - the inverse ofchannel_adapter::{ChannelReader, ChannelWriter}.embedded::connect_and_execso wiring stays consistent across the two call-sites.DEFAULT_CHANNEL_CAPACITY);into_sync_halves_with_capacitylets tests size it down to exercise backpressure.Test plan
cargo nextest run -p rsync_io --features embedded-ssh -E 'test(sync_bridge)'covers the new tests:tokio::io::duplexSyncReaderchunk drain across reads + EOF on sender dropSyncWriterBrokenPipeon closed receiverSyncWriterbackpressure (writer blocks until receiver drains)SyncWritercloses the underlying channelcargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features --no-deps -- -D warningsBuilds on PR #4290 (#1805); default builds are unchanged.