pub trait CopyDestination: Send {
type Transaction<'a>: CopyTransaction + 'a
where Self: 'a;
// Required methods
fn apply_data<R: TableDataReader, C: AsyncCleanup>(
&mut self,
schema: &PostgresSchema,
table: &PostgresTable,
data: TableData<R, C>,
) -> impl Future<Output = Result<()>>;
fn apply_non_transactional_statement(
&mut self,
statement: &str,
) -> impl Future<Output = Result<()>>;
fn begin_transaction(
&mut self,
) -> impl Future<Output = Result<Self::Transaction<'_>>>;
fn get_identifier_quoter(&self) -> Arc<IdentifierQuoter> ⓘ;
// Provided methods
fn finish(&mut self) -> impl Future<Output = Result<()>> { ... }
fn try_introspect(
&self,
) -> impl Future<Output = Result<Option<PostgresDatabase>>> { ... }
fn has_data_in_table(
&self,
_schema: &PostgresSchema,
_table: &PostgresTable,
) -> impl Future<Output = Result<bool>> { ... }
}Required Associated Types§
Sourcetype Transaction<'a>: CopyTransaction + 'a
where
Self: 'a
type Transaction<'a>: CopyTransaction + 'a where Self: 'a
The transaction type returned by begin_transaction.
Required Methods§
Sourcefn apply_data<R: TableDataReader, C: AsyncCleanup>(
&mut self,
schema: &PostgresSchema,
table: &PostgresTable,
data: TableData<R, C>,
) -> impl Future<Output = Result<()>>
fn apply_data<R: TableDataReader, C: AsyncCleanup>( &mut self, schema: &PostgresSchema, table: &PostgresTable, data: TableData<R, C>, ) -> impl Future<Output = Result<()>>
This should apply the data to the destination. The data is expected to be in the
format returned by supported_data_format, if possible.
Sourcefn apply_non_transactional_statement(
&mut self,
statement: &str,
) -> impl Future<Output = Result<()>>
fn apply_non_transactional_statement( &mut self, statement: &str, ) -> impl Future<Output = Result<()>>
This should apply the DDL statements to the destination. These commands has to be run outside a transaction, as they might fail otherwise.
Sourcefn begin_transaction(
&mut self,
) -> impl Future<Output = Result<Self::Transaction<'_>>>
fn begin_transaction( &mut self, ) -> impl Future<Output = Result<Self::Transaction<'_>>>
Should begin a new transaction and return a handle to it.
Sourcefn get_identifier_quoter(&self) -> Arc<IdentifierQuoter> ⓘ
fn get_identifier_quoter(&self) -> Arc<IdentifierQuoter> ⓘ
Should get the identifier quoter that works with this destination. This ensures quoting respects the rules of the destination, not the source.
Provided Methods§
fn finish(&mut self) -> impl Future<Output = Result<()>>
Sourcefn try_introspect(
&self,
) -> impl Future<Output = Result<Option<PostgresDatabase>>>
fn try_introspect( &self, ) -> impl Future<Output = Result<Option<PostgresDatabase>>>
Should try to introspect the destination. If introspection is not supported, this should return Ok(None),
not an error. Errors should only be returned if introspection is supported, but failed.
fn has_data_in_table( &self, _schema: &PostgresSchema, _table: &PostgresTable, ) -> impl Future<Output = Result<bool>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".