Skip to main content

PgSink

Struct PgSink 

Source
pub struct PgSink { /* private fields */ }

Implementations§

Source§

impl PgSink

Source

pub async fn new(client: PgClient, limits: SinkLimits) -> Result<Self>

Prepare a connected target client: create the metadata schema and configure the session for replica apply.

Source

pub fn restrict_to(self, tables: &[TableName]) -> Self

Restrict apply to the configured tables (run path). Without this, every published relation that exists on the target is accepted (status/cleanup never apply anything, so they do not need it).

Source

pub fn client(&self) -> &PgClient

Source

pub async fn record_table_copied( client: &PgClient, job_id: &str, schema: &str, table: &str, rows: u64, bytes: u64, ) -> Result<()>

Record a table as copied during the snapshot (inside the caller’s transaction).

Trait Implementations§

Source§

impl ReplicationSink for PgSink

Source§

async fn load_checkpoint(&mut self, job_id: &str) -> Result<Option<Checkpoint>>

Load the job’s checkpoint; None if the job has never been bootstrapped.
Source§

async fn save_checkpoint(&mut self, cp: &Checkpoint) -> Result<()>

Persist a checkpoint outside of any data transaction (autocommit).
Source§

async fn begin(&mut self) -> Result<()>

Start a destination transaction.
Source§

async fn relation(&mut self, rel: Arc<Relation>) -> Result<()>

Relation metadata; may arrive inside or outside a transaction and must be cached.
Source§

async fn apply(&mut self, op: Op) -> Result<()>

Apply one change inside the open transaction. Implementations may batch.
Source§

async fn commit(&mut self, cp: &Checkpoint) -> Result<()>

Flush pending changes, write cp, and commit atomically. After Ok, the data and the checkpoint are durable.
Source§

async fn rollback(&mut self) -> Result<()>

Abort the open transaction, if any. Best effort; must not panic.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more