Skip to content

SC-13: batch mode (--write-batch, --read-batch) - #16

Merged
iampryce merged 1 commit into
mainfrom
sc-13-batch-mode
Aug 2, 2026
Merged

SC-13: batch mode (--write-batch, --read-batch)#16
iampryce merged 1 commit into
mainfrom
sc-13-batch-mode

Conversation

@iampryce

@iampryce iampryce commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@iampryce
iampryce requested a review from jasonmiller-cc August 2, 2026 17:29
@iampryce
iampryce merged commit 5ef735d into main Aug 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant