Skip to main content

drasi_bootstrap_postgres/
lib.rs

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