feat: --append / --append-verify tail-only resume
Implement rsync's append modes: when an existing destination file is SHORTER than the source, the receiver negotiates a resume offset and only the tail is transferred; the full file (retained prefix + tail) is rebuilt and installed through the normal atomic store path, so the result is byte-identical to the source whenever the prefix matches. - --append: sends the tail without content-verifying the retained prefix (rsync parity; the documented prefix-trust risk). - --append-verify: verifies the retained prefix against the source's prefix xxHash64 before appending and, on a mismatch, falls back to a clean full transfer (never a corrupt prefix+tail blend). New wire frames STATUS_APPEND / STATUS_APPEND_SIG / STATUS_APPEND_OK / STATUS_APPEND_DATA; PROTOCOL_VERSION bumped 2.9.0 -> 2.10.0 (peers must match). Both flags imply --incremental and are incompatible with -s (chunk serialization) and --whole-file (rejected up front). Respects --inplace, --partial/--partial-dir and --delay-updates via the shared store engine.
This commit is contained in:
@@ -53,5 +53,13 @@ void utils_set_authorized_root_fd(int fd);
|
||||
bool has_path_traversal(const char* path);
|
||||
bool utils_valid_batch_path(const char* path);
|
||||
bool format_human_bytes(unsigned long long bytes, char* buffer, size_t buffer_size);
|
||||
/* --append / --append-verify tail-resume math (pure). A resume is eligible only
|
||||
when an existing destination file is SHORTER than the source; the tail length
|
||||
is then the difference. append_resume_eligible answers whether the shorter
|
||||
file makes a resume possible; append_tail_length additionally returns that
|
||||
tail length, refusing (false) the degenerate old_size >= check_size case. */
|
||||
bool append_resume_eligible(unsigned long long old_size, unsigned long long check_size);
|
||||
bool append_tail_length(unsigned long long old_size, unsigned long long check_size,
|
||||
unsigned long long* tail_out);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user