Skip to main content

CopyInHandler

Trait CopyInHandler 

Source
pub trait CopyInHandler: Send + Sync {
    // Required methods
    fn copy_in_table<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        catalog: &'life1 str,
        schema: &'life2 str,
        table: &'life3 str,
        query_ctx: QueryContextRef,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TableInfoRef>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn copy_in_validate_scope<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        catalog: &'life1 str,
        schema: &'life2 str,
        query_ctx: QueryContextRef,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn copy_in_insert<'life0, 'async_trait>(
        &'life0 self,
        requests: RowInsertRequests,
        query_ctx: QueryContextRef,
    ) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn copy_in_arrow(
        &self,
        _stream: PutRecordBatchRequestStream,
        _query_ctx: QueryContextRef,
    ) -> Result<BoxStream<'static, Result<DoPutResponse>>> { ... }
}
Expand description

Handler for the PostgreSQL COPY ... FROM STDIN (copy-in) sub-protocol.

The servers layer owns the wire protocol and data parsing; this trait is the boundary to catalog lookup and ingestion, implemented by the frontend instance.

Required Methods§

Source

fn copy_in_table<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, catalog: &'life1 str, schema: &'life2 str, table: &'life3 str, query_ctx: QueryContextRef, ) -> Pin<Box<dyn Future<Output = Result<Option<TableInfoRef>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Resolves the target table of a COPY and returns its metadata, or None when the table does not exist. Implementations should also enforce the write permission for the table here so unauthorized copies fail before any data is transferred.

Source

fn copy_in_validate_scope<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, catalog: &'life1 str, schema: &'life2 str, query_ctx: QueryContextRef, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Validates that a COPY target’s resolved catalog/schema is within the session’s allowed scope, before any data is transferred. Enforces the disallow_cross_catalog_query restriction for targets that leave the session’s catalog — the same restriction SQL INSERT and copy_in_table enforce. A no-op when the restriction is disabled.

Source

fn copy_in_insert<'life0, 'async_trait>( &'life0 self, requests: RowInsertRequests, query_ctx: QueryContextRef, ) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Inserts a parsed batch produced by a COPY stream. Returns the number of affected rows.

Provided Methods§

Source

fn copy_in_arrow( &self, _stream: PutRecordBatchRequestStream, _query_ctx: QueryContextRef, ) -> Result<BoxStream<'static, Result<DoPutResponse>>>

Ingests Arrow batches through the same bulk path as Flight DoPut. The COPY transport owns framing and memory admission; implementations retain stream-level authorization and schema reconciliation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§