Struct dataflow::source::PostgresSourceReader [−][src]
pub struct PostgresSourceReader {
source_name: String,
connector: PostgresSourceConnector,
lsn: PgLsn,
metrics: PgSourceMetrics,
}
Expand description
Information required to sync data from Postgres
Fields
source_name: String
Used to produce useful error messages
connector: PostgresSourceConnector
lsn: PgLsn
Our cursor into the WAL
metrics: PgSourceMetrics
Implementations
pub fn new(
source_name: String,
connector: PostgresSourceConnector,
metrics: &SourceBaseMetrics
) -> Self
pub fn new(
source_name: String,
connector: PostgresSourceConnector,
metrics: &SourceBaseMetrics
) -> Self
Constructs a new instance
async fn produce_snapshot<W: AsyncWrite + Unpin>(
&mut self,
snapshot_tx: &mut SourceTransaction<'_>,
buffer: &mut W
) -> Result<(), ReplicationError>
async fn produce_snapshot<W: AsyncWrite + Unpin>(
&mut self,
snapshot_tx: &mut SourceTransaction<'_>,
buffer: &mut W
) -> Result<(), ReplicationError>
Creates the replication slot and produces the initial snapshot of the data
After the initial snapshot has been produced it returns the name of the created slot and the LSN at which we should start the replication stream at.
async fn revert_snapshot<R: Read + Seek>(
&self,
snapshot_tx: &mut SourceTransaction<'_>,
reader: R
) -> Result<(), Error>
async fn revert_snapshot<R: Read + Seek>(
&self,
snapshot_tx: &mut SourceTransaction<'_>,
reader: R
) -> Result<(), Error>
Reverts a failed snapshot by deleting any processed rows from the dataflow.
fn row_from_tuple<'a, T>(
&mut self,
rel_id: u32,
tuple_data: T
) -> Result<Row, Error> where
T: IntoIterator<Item = &'a TupleData>,
fn row_from_tuple<'a, T>(
&mut self,
rel_id: u32,
tuple_data: T
) -> Result<Row, Error> where
T: IntoIterator<Item = &'a TupleData>,
Converts a Tuple received in the replication stream into a Row instance. The logical replication protocol doesn’t use the binary encoding for column values so contrary to the initial snapshot here we need to parse the textual form of each column.
The old_tuple
argument can be used as a source of data to use when encountering unchanged
TOAST values.
async fn produce_replication(
&mut self,
timestamper: &Timestamper
) -> Result<(), ReplicationError>
Trait Implementations
fn start<'life0, 'async_trait>(
self,
timestamper: &'life0 Timestamper
) -> Pin<Box<dyn Future<Output = Result<(), SourceError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn start<'life0, 'async_trait>(
self,
timestamper: &'life0 Timestamper
) -> Pin<Box<dyn Future<Output = Result<(), SourceError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The top-level control of the state machine and retry logic
Auto Trait Implementations
impl !RefUnwindSafe for PostgresSourceReader
impl Send for PostgresSourceReader
impl Sync for PostgresSourceReader
impl Unpin for PostgresSourceReader
impl !UnwindSafe for PostgresSourceReader
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more