Skip to main content

Module protocol

Module protocol 

Source
Expand description

Wire protocol message types shared between client and server.

Control messages are serialized as JSON in framed envelopes (see frame.rs). File data is streamed as raw bytes outside the framing layer.

§Message flow

Client                                 Server
  |                                      |
  |--- Handshake ----------------------->|
  |<-- HandshakeAck ---------------------|
  |                                      |
  |--- ArchiveRequest ------------------>|
  |<-- ArchiveAccept --------------------|
  |--- [FileHeader + raw chunks]* ------>|
  |--- ArchiveComplete ----------------->|
  |                                      |
  |--- RestoreRequest ------------------>|
  |<-- RestoreAccept --------------------|
  |<-- [FileHeader + raw chunks]* -------|
  |<-- RestoreComplete ------------------|
  |                                      |
  |--- StatusRequest ------------------->|
  |<-- StatusResponse -------------------|

Structs§

ArchiveAccept
Server accepts the archive request and assigns a session.
ArchiveComplete
Client reports the final outcome of the archive transfer.
ArchiveRequest
Client requests permission to upload a project archive.
ErrorMessage
Generic error response sent by either party on protocol violations, authentication failures, or storage errors.
FileEnd
Sent after a file’s content has been fully streamed.
FileHeader
Metadata for a single file within a project archive.
Handshake
Sent by the client immediately after the TLS handshake completes.
HandshakeAck
Server response to a Handshake message.
ProjectInfo
Summary information about a stored project.
RestoreAccept
Server accepts the restore request and provides metadata.
RestoreComplete
Server reports the restore transfer is complete.
RestoreRequest
Client requests a project archive be sent back for restore.
StatusRequest
Request project information from the server. An empty request returns all projects; provide a UUID to query one.
StatusResponse
Server response with matching project information.

Enums§

ClientMessage
All messages a client can send to the server.
MessageType
Identifies the type of a protocol message in the frame header.
ServerMessage
All messages a server can send to the client.

Constants§

CHUNK_SIZE
Default chunk size for file streaming: 1 MiB.
PROTOCOL_VERSION
Protocol version constant. Both client and server must agree on this.

Functions§

build_archive_accept
Build an ArchiveAccept server message.
build_archive_complete
Build a successful ArchiveComplete message.
build_archive_failed
Build a failed ArchiveComplete message.
build_archive_request
Build an ArchiveRequest message for the given project metadata.
build_error
Build an Error server message.
build_handshake_ack_failed
Build a HandshakeAck for failed authentication.
build_handshake_ack_success
Build a HandshakeAck for successful authentication.
build_restore_accept
Build a RestoreAccept server response with session and metadata.
build_restore_complete
Build a successful RestoreComplete message.
build_restore_failed
Build a failed RestoreComplete message.
build_restore_request
Build a RestoreRequest for a project UUID.
build_status_response
Build a StatusResponse with project listings.
decode_client_message
Deserialize a client message from raw frame payload bytes.
decode_server_message
Deserialize a server message from raw frame payload bytes.