Skip to main content

Module protocol

Module protocol 

Source
Expand description

Wire protocol implementation for Hyper database.

This module implements the PostgreSQL wire protocol with Hyper-specific extensions for LittleEndian binary format (HyperBinary). It sits between the sibling types module (type system) and client module (connection management).

§Two-Layer Byte Order Design

The Hyper wire protocol has two layers with different byte orders:

LayerByte OrderModulesRationale
Message framingBigEndianmessagePostgreSQL specification compatibility
Data encodingLittleEndiancopy, typesHyper’s native format, optimized for x86/x64

All message headers, lengths, and column counts use BigEndian (network byte order), exactly like standard PostgreSQL. Actual data values inside those messages use LittleEndian, which is Hyper’s native format. This lets Hyper stay compatible with PostgreSQL client libraries while avoiding byte-swapping on the dominant deployment architectures.

§Modules

  • message – Frontend (client-to-server) and backend (server-to-client) message framing, parsing, and construction. All lengths are BigEndian.
  • copyHyperBinary COPY format: header, row encoding, and read helpers. All data values are LittleEndian.
  • types – Conversion between Rust types and HyperBinary format (LittleEndian encoding/decoding).
  • escape – SQL identifier and literal escaping via zero-cost newtype wrappers with std::fmt::Display implementations.

Re-exports§

pub use crate::types::Oid;
pub use types::ParseError;

Modules§

copy
HyperBinary COPY format support.
escape
SQL escaping utilities.
message
PostgreSQL wire protocol message framing and parsing.
types
Type conversion utilities for HyperBinary format.