Expand description
Database client for mz-deploy.
This module provides the main Client struct for interacting with Materialize.
The client handles connection management and delegates specialized operations
to domain-specific sub-clients.
Β§Sub-Client Architecture
Operations are grouped into domain sub-clients accessed via accessor methods
on Client. Each sub-client borrows the Client and provides a focused API:
| Sub-client | Accessor | Responsibility |
|---|---|---|
DeploymentsClient | .deployments() | Deployment lifecycle (stage, promote, abort) |
DeploymentsClientMut | .deployments_mut() | Mutable deployment ops (SUBSCRIBE cursors) |
IntrospectionClient | .introspection() | Read-only catalog metadata queries |
ValidationClient | .validation() | Pre-deployment environment checks |
TypeInfoClient | .types() | Column/type introspection for type checking |
ProvisioningClient | .provisioning() | Idempotent DDL for databases, schemas, clusters |
Β§TLS Policy
Per-profile sslmode with libpq semantics (disable, prefer, require,
verify-ca, verify-full). When unset, loopback hosts default to
prefer and everything else defaults to require. See the design at
docs/superpowers/specs/2026-04-22-profile-tls-design.md for the behavior
table and migration notes.
StructsΒ§
- Client
- Database client for interacting with Materialize.
- Deployments
Client - Domain sub-client for deployment lifecycle operations.
- Deployments
Client Mut - Domain sub-client for deployment operations that require mutable client access.
- DevOverlays
Client - Domain sub-client for developer overlay manifest operations.
- Introspection
Client - Domain sub-client for metadata and object introspection operations.
- Provisioning
Client - Domain sub-client for provisioning databases, schemas, and clusters.
- Type
Info Client - Domain sub-client for column/type introspection used by type checking and tests.
- Validation
Client - Domain sub-client for project and privilege validation operations.
EnumsΒ§
- CaSource π
- Where the CA bundle comes from for verifying the server cert, or the absence thereof for non-verifying modes.
- Connector π
- Runtime-ready connector variant handed to
tokio_postgres::Config::connect. - Connector
Spec π - Pure-data representation of the TLS setup for a connection, derived from
a profileβs effective
SslModeandsslrootcert. - Host
Check π - How
verify-fullshould match the certβs SAN entries.
ConstantsΒ§
- APPLICATION_
NAME π - DEFAULT_
CA_ πPATHS - Platform CA bundle candidates, walked in order by
build_connectorwhensslmoderesolves toverify-ca/verify-fulland the profile does not setsslrootcert. Kept in sync with libpq-like installations on our supported platforms.
FunctionsΒ§
- build_
connector π - Convert a
ConnectorSpecinto a runtimeConnectorby wiring up the OpenSSL context. All filesystem I/O for CAs happens here. - build_
options_ πstring - Build the inner value of the libpq
optionsconnection parameter from a profileβs options map. - classify_
connect_ πerror - Classify a
tokio_postgres::Errorsurfaced fromConfig::connect(...)into the most specificConnectionErrorvariant. - default_
sslmode π - The default
SslModeapplied when a profile does not setsslmode. - escape_
options_ πvalue - Escape a value for embedding inside the libpq
optionsconnection parameter. - is_
loopback_ πhost - Returns
trueifhostnames the loopback interface. - matches_
tls_ πrefused_ message - Pure string check for the substrings
tokio_postgresproduces when the server refuses the TLS startup request (responds'N'to the SSL byte). - message_
indicates_ πtls_ refused - Heuristic: does the error look like βserver said no to our TLS requestβ?
- plan_
connector π - Plan the TLS setup for a connection from the resolved (mode, CA) inputs.
- resolve_
ca_ πsource - ssl_
error_ πin_ chain - Walk the source chain of a
tokio_postgres::Errorand return the string form of the firstopenssl::error::ErrorStackfound. - tokio_
ssl_ πmode