Skip to main content

Module backend

Module backend 

Source
Expand description

Backend (server-to-client) messages.

This module parses messages sent from the Hyper server to the client. Each message variant is discriminated by a single-byte tag; see the *_TAG constants and the Message enum for the full catalog.

§Authentication Flow

The server initiates authentication with an Authentication* message. Supported methods:

MethodTag subtypeFlow
TrustR(0)Server sends AuthenticationOk immediately
CleartextR(3)Server requests password; client sends PasswordMessage
MD5R(5) + 4-byte saltClient hashes md5(md5(password + user) + salt)
SCRAM-SHA-256R(10)Multi-step challenge-response via SASLInitialResponse / SASLResponse

After successful authentication the server sends AuthenticationOk, followed by ParameterStatus messages, BackendKeyData, and finally ReadyForQuery.

§Attribution

Portions of this module were adapted from postgres-protocol’s message/backend.rs (Copyright (c) 2016 Steven Fackler, MIT or Apache-2.0). Adapted material includes the message-tag constants (PARSE_COMPLETE_TAG = b'1', BIND_COMPLETE_TAG = b'2', …, AUTHENTICATION_TAG = b'R', etc.), the Header struct shape, and message-framing logic. Hyper-specific changes added on top include the HyperBinary COPY format and Hyper-specific message variants. See the NOTICE file at the repo root for the full upstream copyright and reproduced license text.

Structs§

AuthenticationMd5PasswordBody
MD5 password authentication body.
AuthenticationSaslBody
SASL authentication body.
AuthenticationSaslContinueBody
SASL continue authentication body.
AuthenticationSaslFinalBody
SASL final authentication body.
BackendKeyDataBody
Backend key data body.
CommandCompleteBody
Command complete body.
CopyDataBody
COPY data body.
CopyInResponseBody
COPY IN response body.
CopyOutResponseBody
COPY OUT response body.
DataRowBody
Data row body.
DataRowRanges
Iterator over data row column ranges.
ErrorField
A single error or notice field.
ErrorFields
Iterator over error fields in an ErrorResponse or NoticeResponse.
ErrorResponseBody
Error response body.
Field
A field description in a RowDescription.
Fields
Iterator over field descriptions in a RowDescription.
Header
Message header information.
NoticeResponseBody
Notice response body (same format as error).
NotificationResponseBody
Notification response body.
ParameterDescriptionBody
Parameter description body.
ParameterStatusBody
Parameter status body.
Parameters
Iterator over parameter OIDs in a ParameterDescription.
ReadyForQueryBody
Ready for query body.
RowDescriptionBody
Row description body.
SaslMechanisms
Iterator over SASL mechanism names in an authentication message.

Enums§

Message
An enum representing backend messages from Hyper server.

Constants§

AUTHENTICATION_TAG
Message tag for Authentication (‘R’).
BACKEND_KEY_DATA_TAG
Message tag for BackendKeyData (‘K’).
BIND_COMPLETE_TAG
Message tag for BindComplete (‘2’).
CLOSE_COMPLETE_TAG
Message tag for CloseComplete (‘3’).
COMMAND_COMPLETE_TAG
Message tag for CommandComplete (‘C’).
COPY_DATA_TAG
Message tag for CopyData (‘d’).
COPY_DONE_TAG
Message tag for CopyDone (‘c’).
COPY_IN_RESPONSE_TAG
Message tag for CopyInResponse (‘G’).
COPY_OUT_RESPONSE_TAG
Message tag for CopyOutResponse (‘H’).
DATA_ROW_TAG
Message tag for DataRow (‘D’).
EMPTY_QUERY_RESPONSE_TAG
Message tag for EmptyQueryResponse (‘I’).
ERROR_RESPONSE_TAG
Message tag for ErrorResponse (‘E’).
NOTICE_RESPONSE_TAG
Message tag for NoticeResponse (‘N’).
NOTIFICATION_RESPONSE_TAG
Message tag for NotificationResponse (‘A’).
NO_DATA_TAG
Message tag for NoData (‘n’).
PARAMETER_DESCRIPTION_TAG
Message tag for ParameterDescription (‘t’).
PARAMETER_STATUS_TAG
Message tag for ParameterStatus (‘S’).
PARSE_COMPLETE_TAG
Message tag for ParseComplete (‘1’).
PORTAL_SUSPENDED_TAG
Message tag for PortalSuspended (‘s’).
READY_FOR_QUERY_TAG
Message tag for ReadyForQuery (‘Z’).
ROW_DESCRIPTION_TAG
Message tag for RowDescription (‘T’).