rsync supports --compress-choice=zstd|zlib|lz4 and --zc / --compress-level
Negotiates compression algorithm between client and server
Current FastSync behavior:
FastSync only supports zstd. The client unilaterally sets use_compression and compression_level, and the server must accept zstd. If a future peer does not support zstd, the connection cannot proceed.
Proposed changes:
CLI flags: --compress-choice=<algo> (or --zc), keep -c/--compress as shortcut for zstd default
Config field: CompressionAlgorithm compression_algorithm and existing compression_level
Supported algorithms: none, zstd (default), optionally lz4 and zlib
Protocol changes:
During config handshake, advertise supported algorithms
Pick a mutually supported algorithm; fall back to no compression if none match
Send chosen algorithm in config or via a new STATUS_NEGOTIATE step
Implementation:
Abstract compression interface with per-algorithm compress/decompress functions
Make data_compress/data_decompress dispatch based on negotiated algorithm
Priority: low Rationale: zstd is excellent, but supporting lz4 (faster, lower CPU) and zlib (broader compatibility) gives users more trade-offs. Negotiation is also needed for protocol extensibility.
Acceptance criteria:
--compress-choice=none disables compression even when -c is used
Client and server negotiate zstd when both support it
A client requiring only lz4 falls back to no compression against an older zstd-only server
Compression choice is reflected in --stats output
**Corresponding rsync flags/behavior:**
- rsync supports `--compress-choice=zstd|zlib|lz4` and `--zc` / `--compress-level`
- Negotiates compression algorithm between client and server
**Current FastSync behavior:**
FastSync only supports zstd. The client unilaterally sets `use_compression` and `compression_level`, and the server must accept zstd. If a future peer does not support zstd, the connection cannot proceed.
**Proposed changes:**
- CLI flags: `--compress-choice=<algo>` (or `--zc`), keep `-c/--compress` as shortcut for zstd default
- Config field: `CompressionAlgorithm compression_algorithm` and existing `compression_level`
- Supported algorithms: `none`, `zstd` (default), optionally `lz4` and `zlib`
- Protocol changes:
- During config handshake, advertise supported algorithms
- Pick a mutually supported algorithm; fall back to no compression if none match
- Send chosen algorithm in config or via a new `STATUS_NEGOTIATE` step
- Implementation:
- Abstract compression interface with per-algorithm compress/decompress functions
- Make `data_compress`/`data_decompress` dispatch based on negotiated algorithm
**Priority:** low
**Rationale:** zstd is excellent, but supporting lz4 (faster, lower CPU) and zlib (broader compatibility) gives users more trade-offs. Negotiation is also needed for protocol extensibility.
**Acceptance criteria:**
- [ ] `--compress-choice=none` disables compression even when `-c` is used
- [ ] Client and server negotiate zstd when both support it
- [ ] A client requiring only lz4 falls back to no compression against an older zstd-only server
- [ ] Compression choice is reflected in `--stats` output
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Corresponding rsync flags/behavior:
--compress-choice=zstd|zlib|lz4and--zc/--compress-levelCurrent FastSync behavior:
FastSync only supports zstd. The client unilaterally sets
use_compressionandcompression_level, and the server must accept zstd. If a future peer does not support zstd, the connection cannot proceed.Proposed changes:
--compress-choice=<algo>(or--zc), keep-c/--compressas shortcut for zstd defaultCompressionAlgorithm compression_algorithmand existingcompression_levelnone,zstd(default), optionallylz4andzlibSTATUS_NEGOTIATEstepdata_compress/data_decompressdispatch based on negotiated algorithmPriority: low
Rationale: zstd is excellent, but supporting lz4 (faster, lower CPU) and zlib (broader compatibility) gives users more trade-offs. Negotiation is also needed for protocol extensibility.
Acceptance criteria:
--compress-choice=nonedisables compression even when-cis used--statsoutput