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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//! # PostgreSQL Manager
//!
//! A comprehensive library for managing PostgreSQL installations on remote servers via SSH.
//!
//! ## Features
//!
//! - **Builder Pattern API**: Fluent, type-safe configuration
//! - **Idempotent Operations**: Safe to run multiple times
//! - **Diff Detection**: Track configuration changes
//! - **Full Lifecycle**: Install, configure, update, and uninstall
//! - **SSH-based**: Uses ssh-manager for secure remote operations
//! - **Error Handling**: Comprehensive error types with context
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use lmrc_postgres::{PostgresConfig, PostgresManager};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Build PostgreSQL configuration
//! let config = PostgresConfig::builder()
//! .version("15")
//! .database_name("myapp")
//! .username("myuser")
//! .password("secure_password")
//! .listen_addresses("0.0.0.0/0")
//! .port(5432)
//! .max_connections(100)
//! .shared_buffers("256MB")
//! .build()?;
//!
//! // Create manager and connect
//! let manager = PostgresManager::builder()
//! .config(config)
//! .server_ip("192.168.1.100")
//! .ssh_user("root")
//! .build()?;
//!
//! // Install and configure PostgreSQL
//! manager.install().await?;
//! manager.configure().await?;
//!
//! // Test the connection
//! manager.test_connection().await?;
//!
//! Ok(())
//! }
//! ```
//!
//! ## Examples
//!
//! ### Install with custom configuration
//!
//! ```rust,no_run
//! # use lmrc_postgres::{PostgresConfig, PostgresManager};
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let config = PostgresConfig::builder()
//! .version("15")
//! .database_name("production_db")
//! .username("app_user")
//! .password("strong_password")
//! .listen_addresses("10.0.0.0/8")
//! .port(5432)
//! .max_connections(200)
//! .shared_buffers("512MB")
//! .effective_cache_size("2GB")
//! .build()?;
//!
//! let manager = PostgresManager::builder()
//! .config(config)
//! .server_ip("10.0.1.50")
//! .ssh_user("admin")
//! .build()?;
//!
//! manager.setup().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ### Detect configuration changes
//!
//! ```rust,no_run
//! # use lmrc_postgres::{PostgresConfig, PostgresManager};
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! # let manager = PostgresManager::builder()
//! # .config(PostgresConfig::builder().version("15").build()?)
//! # .server_ip("192.168.1.100")
//! # .build()?;
//! let diff = manager.diff().await?;
//!
//! if diff.has_changes() {
//! println!("Configuration changes detected:");
//! for change in diff.changes() {
//! println!(" - {}", change);
//! }
//!
//! // Apply changes
//! manager.apply_diff(&diff).await?;
//! }
//! # Ok(())
//! # }
//! ```
pub use PostgresAdapter;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// Re-export ssh-manager for convenience
pub use ;