Add typed builder functions for all protocol message flows
Introduce convenience constructors in the protocol module that build
ClientMessage and ServerMessage enums from their constituent fields,
eliminating the need for callers to construct nested struct literals.
For the archive flow, build_archive_request accepts a UUID, name, size,
file count, and compression flag, while build_archive_complete and
build_archive_failed produce the terminal ArchiveComplete variants.
For the restore flow, build_restore_request wraps a project UUID,
build_restore_accept bundles session metadata with size and hash,
build_restore_complete signals success, and build_restore_failed
attaches an error string. Handshake builders handle both success and
failure Ack messages with the server nonce, proof, and optional
reason. Additional helpers cover ArchiveAccept, StatusResponse, and
generic Error messages. These builders centralize protocol message
construction so handler and client code does not repeat struct
literals and reduces the surface area for missing required fields.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.