1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Backend PostgreSQL client used by TR-management code paths.
//!
//! `ProxyServer::route_and_forward` still forwards client frames to
//! backends without ever parsing or originating SQL — that zero-copy
//! path remains untouched. This module is the *other* direction: the
//! proxy itself acts as a PG client for internal management queries
//! (health checks, `pg_is_in_recovery()`, `pg_promote()`, WAL-position
//! probes, failover replay, session-state restoration).
//!
//! Design goals:
//!
//! * **No `tokio-postgres`.** We reuse `crate::protocol` for every
//! wire frame so the crate has exactly one PG protocol
//! implementation.
//! * **TLS-capable.** `tls::negotiate` performs the `SSLRequest`
//! dance and wraps the TCP stream in `tokio-rustls` when accepted.
//! * **Text format only.** All parameter values are interpolated as
//! quoted SQL literals before send; extended-protocol
//! Parse/Bind/Execute is deliberately out of scope for internal
//! management queries.
//! * **Narrow type surface.** Seven OIDs — BOOL, INT4, INT8, TEXT,
//! FLOAT8, TIMESTAMPTZ, NUMERIC — plus PG_LSN for WAL positions.
//!
//! # Example
//!
//! ```no_run
//! use heliosdb_proxy::backend::{BackendClient, BackendConfig, tls, TlsMode};
//! use std::time::Duration;
//!
//! # async fn f() -> heliosdb_proxy::backend::BackendResult<()> {
//! let cfg = BackendConfig {
//! host: "primary.db.internal".into(),
//! port: 5432,
//! user: "postgres".into(),
//! password: Some("secret".into()),
//! database: Some("app".into()),
//! application_name: Some("helios-health".into()),
//! tls_mode: TlsMode::Prefer,
//! connect_timeout: Duration::from_secs(5),
//! query_timeout: Duration::from_secs(5),
//! tls_config: tls::default_client_config(),
//! };
//! let mut c = BackendClient::connect(&cfg).await?;
//! let in_recovery = c.query_scalar("SELECT pg_is_in_recovery()").await?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use Stream;
pub use TlsMode;
pub use ;