pub struct PostgresConnection { /* private fields */ }Expand description
PostgreSQL connector lifecycle manager.
Implementations§
Source§impl PostgresConnection
impl PostgresConnection
pub fn new(config: PostgresSourceConfig) -> Self
pub fn with_logger( config: PostgresSourceConfig, logger: StructuredLogger, ) -> Self
pub async fn connect(&self) -> Result<()>
pub async fn close(&self)
pub async fn is_connected(&self) -> bool
pub async fn start_snapshot_from_checkpoint( &mut self, tables: &[&str], resume_from: Option<&dyn Offset>, ) -> Result<Box<dyn SnapshotHandle>>
Sourcepub async fn start_incremental_snapshot(
&mut self,
config: IncrementalSnapshotConfig,
resume_from: Option<&dyn Offset>,
) -> Result<Box<dyn StreamHandle>>
pub async fn start_incremental_snapshot( &mut self, config: IncrementalSnapshotConfig, resume_from: Option<&dyn Offset>, ) -> Result<Box<dyn StreamHandle>>
Start an incremental (non-blocking) snapshot using the DBLog watermark pattern.
Unlike start_snapshot, this method:
- Does not pause the replication stream.
- Does not hold a
REPEATABLE READtransaction. - Reads the table in small chunks (keyset-paginated,
READ COMMITTED). - For each chunk, captures a low/high watermark LSN and uses the replication stream to detect concurrent writes, suppressing stale chunk rows.
The returned StreamHandle interleaves snapshot Read events with live
replication events. Once all tables are exhausted it acts as a pure
stream delegate.
resume_from is forwarded to start_stream to resume from a saved
checkpoint offset.
Trait Implementations§
Source§impl Drop for PostgresConnection
impl Drop for PostgresConnection
Source§impl Source for PostgresConnection
impl Source for PostgresConnection
fn start_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
tables: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Box<dyn SnapshotHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn start_stream<'life0, 'life1, 'async_trait>(
&'life0 mut self,
resume_from: Option<&'life1 dyn Offset>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn StreamHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn perform_handoff<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
snapshot: &'life1 mut dyn SnapshotHandle,
stream: &'life2 mut dyn StreamHandle,
) -> Pin<Box<dyn Future<Output = Result<HandoffResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn source_type(&self) -> &str
fn capabilities(&self) -> ConnectorCapabilities
Source§fn start_snapshot_from_checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
tables: &'life1 [&'life2 str],
_resume_from: Option<&'life3 dyn Offset>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn SnapshotHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn start_snapshot_from_checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
tables: &'life1 [&'life2 str],
_resume_from: Option<&'life3 dyn Offset>,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn SnapshotHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Start snapshot capture from a previously persisted snapshot checkpoint. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PostgresConnection
impl !UnwindSafe for PostgresConnection
impl Freeze for PostgresConnection
impl Send for PostgresConnection
impl Sync for PostgresConnection
impl Unpin for PostgresConnection
impl UnsafeUnpin for PostgresConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more