SC-13: batch mode (--write-batch, --read-batch) - #16
Merged
Conversation
Verified via real rsync's batch.c before writing any code: a real batch
file isn't a separate serialization format, it's the raw multiplexed
wire-protocol byte stream (protocol-version-coupled, forced MD4/MD5,
a data-stream-flags bitmap), captured to disk via the same low-level
I/O the live connection uses. Byte-compatibility would mean
reimplementing real rsync's actual wire protocol - exactly what SC-6,
SC-9, and SC-16 each already declined to take on.
Chose Option A explicitly: grsync's own gob-based batch format, NOT
byte-compatible with real rsync's batch files. Architectural payoff:
since Sender only ever writes one FrameFileList and one FrameDelta per
file down its connection, a batch file is just a byte-for-byte tee of
that stream via the existing WriteFrame/ReadFrame functions.
--read-batch reuses pipeline.Receiver completely unchanged, fed
{Reader: batchFile, Writer: io.Discard} instead of a live connection -
zero pipeline-level code changes.
Verified against real rsync source: --write-batch+--read-batch together
is a hard error there too; real rsync silently disables --write-batch
under --dry-run, replicated with an explicit note rather than silent
mimicry.
Self-review: a --write-batch run failing partway would leave a
truncated, misleading batch file on disk - fixed to remove it on any
non-success path, with a regression test.
Scope, disclosed not silent: local/SSH destinations supported,
rsync:// daemon destinations rejected outright (handshake bytes aren't
cleanly separable from batch-worthy frames without deeper daemon
changes); --only-write-batch and the companion .sh script real rsync
produces are both not implemented.
README: prominent blockquote-style format disclosure at the top of the
new Batch Mode section, echoed in the top-level Status section.
Clean on native Windows and cross-compiled Linux.
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.
Verified via real rsync's batch.c before writing any code: a real batch file isn't a separate serialization format, it's the raw multiplexed wire-protocol byte stream (protocol-version-coupled, forced MD4/MD5, a data-stream-flags bitmap), captured to disk via the same low-level I/O the live connection uses. Byte-compatibility would mean reimplementing real rsync's actual wire protocol - exactly what SC-6, SC-9, and SC-16 each already declined to take on.
Chose Option A explicitly: grsync's own gob-based batch format, NOT byte-compatible with real rsync's batch files. Architectural payoff: since Sender only ever writes one FrameFileList and one FrameDelta per file down its connection, a batch file is just a byte-for-byte tee of that stream via the existing WriteFrame/ReadFrame functions. --read-batch reuses pipeline.Receiver completely unchanged, fed {Reader: batchFile, Writer: io.Discard} instead of a live connection - zero pipeline-level code changes.
Verified against real rsync source: --write-batch+--read-batch together is a hard error there too; real rsync silently disables --write-batch under --dry-run, replicated with an explicit note rather than silent mimicry.
Self-review: a --write-batch run failing partway would leave a truncated, misleading batch file on disk - fixed to remove it on any non-success path, with a regression test.
Scope, disclosed not silent: local/SSH destinations supported, rsync:// daemon destinations rejected outright (handshake bytes aren't cleanly separable from batch-worthy frames without deeper daemon changes); --only-write-batch and the companion .sh script real rsync produces are both not implemented.
README: prominent blockquote-style format disclosure at the top of the new Batch Mode section, echoed in the top-level Status section.
Clean on native Windows and cross-compiled Linux.