Implements the client-only residual-batch feature end-to-end:
- src/shared/batch.{c,h}: self-contained single-file batch codec using the
existing chunk_serialize/chunk_deserialize codec (byte-identical by
construction). Magic+format-version header (metadata mode is persisted into
the header so a batch is self-describing across machines), length-prefixed
chunk records, bounded reads that reject malformed/truncated/oversized
records cleanly.
- src/client/client_send.c: write_batch_from_source (deterministic separate
scan pass, loads every chunk's file images, emits header+records) and
apply_batch_to_dest (local apply to a destination root via
file_save_to_disk_full). No wire change, no server involved.
- src/client/client_validation.c: --write-batch XOR --only-write-batch;
--read-batch exclusive with both; --read-batch needs only a DEST,
--only-write-batch only a SOURCE.
- src/client/client_cli.c: main() drives the three batch modes without
connecting/transferring for read/only-write; --write-batch runs the live
transfer (single-threaded so the config survives) then emits the batch.
- tests/test_batch.{c,h} (unit: byte-identical roundtrip with and without
metadata; bad-magic/truncated/oversized rejection) + tests/integration/
test_batch.py (only-write no-server, read-batch no-source roundtrip,
--write-batch with a live transfer, conflict rejections).
- clang-format: realign PART-1 config.h comment block.
No PROTOCOL_VERSION bump, no config-frame field, no server flag.
17 lines
560 B
C
17 lines
560 B
C
#ifndef CLIENT_SEND_H
|
|
#define CLIENT_SEND_H
|
|
|
|
#include "chunk.h"
|
|
#include "config.h"
|
|
#include "transport_tcp.h"
|
|
|
|
int send_chunk(Client* client, Chunk* chunk, Config* config);
|
|
int send_files(Config* config);
|
|
/* Takes ownership only when *config is set to NULL on return. */
|
|
int send_files_multithreaded(Config** config);
|
|
/* Phase 6 residual-batch (client-only). See client_send.c. */
|
|
int write_batch_from_source(const Config* config, const char* batch_path);
|
|
int apply_batch_to_dest(const Config* config, const char* batch_path, const char* dest_root);
|
|
|
|
#endif
|