Skip to main content

Module frontend

Module frontend 

Source
Expand description

Frontend (client-to-server) messages.

Each function in this module writes a single PostgreSQL wire protocol message into a BytesMut buffer. All structural fields (tags, lengths, counts) are written in BigEndian per the PostgreSQL specification.

The functions are intentionally stateless – they append bytes to a buffer and do not manage connection state. The connection layer in hyper-client is responsible for sequencing messages correctly (e.g. Parse/Bind/Execute followed by Sync).

§Attribution

Portions of this module were adapted from postgres-protocol’s message/frontend.rs (Copyright (c) 2016 Steven Fackler, MIT or Apache-2.0). Adapted material includes the PostgreSQL v3.0 protocol-version literal (196608, (3 << 16) | 0), the startup-message framing layout, and the msg_len helper. Hyper-specific changes added on top include performance work and Hyper-specific message variants. See the NOTICE file at the repo root for the full upstream copyright and reproduced license text.

Functions§

bind
Writes a bind message.
cancel_request
Writes a cancel request.
close
Writes a close message.
copy_data
Writes a copy data message.
copy_done
Writes a copy done message.
copy_fail
Writes a copy fail message.
describe
Writes a describe message.
execute
Writes an execute message.
flush
Writes a flush message.
parse
Writes a parse message (prepare statement).
password_message
Writes a password message (for authentication).
query
Writes a simple query message.
sasl_initial_response
Writes a SASL initial response message.
sasl_response
Writes a SASL response message.
startup_message
Writes a startup message to the buffer.
sync
Writes a sync message.
terminate
Writes a terminate message.