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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! PostgreSQL wire protocol implementation
//!
//! This module implements the PostgreSQL wire protocol, allowing HeliosDB-Lite
//! to accept connections from PostgreSQL clients (psql, pgAdmin, etc.).
//!
//! ## Features
//!
//! - **Simple Query Protocol**: Basic query execution (SELECT, INSERT, UPDATE, DELETE)
//! - **Extended Query Protocol**: Prepared statements (Parse, Bind, Execute)
//! - **Authentication**: Clear-text password, MD5, and SCRAM-SHA-256 support
//! - **System Catalogs**: Minimal pg_catalog emulation for client compatibility
//! - **Transaction Support**: BEGIN, COMMIT, ROLLBACK
//!
//! ## Usage
//!
//! ```rust,no_run
//! use heliosdb_nano::{EmbeddedDatabase, protocol::postgres::{PgServerBuilder, AuthMethod}};
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Create database
//! let db = Arc::new(EmbeddedDatabase::new_in_memory()?);
//!
//! // Build PostgreSQL server
//! let server = PgServerBuilder::new()
//! .address("127.0.0.1:5432".parse()?)
//! .auth_method(AuthMethod::Trust)
//! .build(db)?;
//!
//! // Start server (runs until error or shutdown)
//! server.serve().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Protocol Reference
//!
//! This implementation follows the PostgreSQL Frontend/Backend Protocol:
//! <https://www.postgresql.org/docs/current/protocol.html>
//!
//! ## Supported Message Types
//!
//! ### Frontend (Client → Server)
//! - `Query` (Q): Simple query protocol
//! - `Parse` (P): Prepare a statement
//! - `Bind` (B): Bind parameters to a statement
//! - `Execute` (E): Execute a portal
//! - `Describe` (D): Describe a statement or portal
//! - `Sync` (S): Complete extended protocol sequence
//! - `Terminate` (X): Close connection
//!
//! ### Backend (Server → Client)
//! - `Authentication` (R): Authentication request/response
//! - `RowDescription` (T): Result set metadata
//! - `DataRow` (D): Result row data
//! - `CommandComplete` (C): Command execution complete
//! - `ReadyForQuery` (Z): Ready for next query
//! - `ErrorResponse` (E): Error message
//! - `ParameterStatus` (S): Server parameter value
// Re-exports
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use CertificateManager;
pub use ;