Skip to main content

drasi_bootstrap_postgres/
lib.rs

1#![allow(unexpected_cfgs)]
2// Copyright 2025 The Drasi Authors.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//     http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! PostgreSQL bootstrap plugin for Drasi
17//!
18//! This plugin provides the PostgreSQL bootstrap provider implementation following
19//! the instance-based plugin architecture.
20//!
21//! # Example
22//!
23//! ```no_run
24//! use drasi_bootstrap_postgres::PostgresBootstrapProvider;
25//!
26//! // Using the builder
27//! let provider = PostgresBootstrapProvider::builder()
28//!     .with_host("localhost")
29//!     .with_port(5432)
30//!     .with_database("mydb")
31//!     .with_user("user")
32//!     .with_password("password")
33//!     .with_tables(vec!["users".to_string()])
34//!     .build();
35//!
36//! // Or using configuration
37//! use drasi_bootstrap_postgres::{PostgresBootstrapConfig, SslMode};
38//!
39//! let config = PostgresBootstrapConfig {
40//!     host: "localhost".to_string(),
41//!     port: 5432,
42//!     database: "mydb".to_string(),
43//!     user: "user".to_string(),
44//!     password: "password".to_string(),
45//!     tables: vec!["users".to_string()],
46//!     slot_name: "drasi_slot".to_string(),
47//!     publication_name: "drasi_pub".to_string(),
48//!     ssl_mode: SslMode::Disable,
49//!     table_keys: vec![],
50//! };
51//! let provider = PostgresBootstrapProvider::new(config);
52//! ```
53
54pub mod config;
55pub mod descriptor;
56pub mod postgres;
57
58pub use config::{PostgresBootstrapConfig, SslMode, TableKeyConfig};
59pub use postgres::{PostgresBootstrapProvider, PostgresBootstrapProviderBuilder};
60
61/// Dynamic plugin entry point.
62///
63/// Dynamic plugin entry point.
64#[cfg(feature = "dynamic-plugin")]
65drasi_plugin_sdk::export_plugin!(
66    plugin_id = "postgres-bootstrap",
67    core_version = env!("CARGO_PKG_VERSION"),
68    lib_version = env!("CARGO_PKG_VERSION"),
69    plugin_version = env!("CARGO_PKG_VERSION"),
70    source_descriptors = [],
71    reaction_descriptors = [],
72    bootstrap_descriptors = [descriptor::PostgresBootstrapDescriptor],
73);