Skip to main content

OutputFormat

Trait OutputFormat 

Source
pub trait OutputFormat: Send + Sync {
    // Required methods
    fn name(&self) -> Cow<'static, str>;
    fn config_from_http_request(
        &self,
        endpoint_name: &str,
        request: &HttpRequest,
    ) -> Result<Box<dyn ErasedSerialize>, ControllerError>;
    fn new_encoder(
        &self,
        endpoint_name: &str,
        config: &ConnectorConfig,
        key_schema: &Option<Relation>,
        value_schema: &Relation,
        consumer: Box<dyn OutputConsumer>,
        is_index: bool,
    ) -> Result<Box<dyn Encoder>, ControllerError>;
}

Required Methods§

Source

fn name(&self) -> Cow<'static, str>

Unique name of the data format.

Source

fn config_from_http_request( &self, endpoint_name: &str, request: &HttpRequest, ) -> Result<Box<dyn ErasedSerialize>, ControllerError>

Extract encoder configuration from an HTTP request.

Returns the extracted configuration cast to the ErasedSerialize trait object (to keep this trait object-safe).

Source

fn new_encoder( &self, endpoint_name: &str, config: &ConnectorConfig, key_schema: &Option<Relation>, value_schema: &Relation, consumer: Box<dyn OutputConsumer>, is_index: bool, ) -> Result<Box<dyn Encoder>, ControllerError>

Create a new encoder for the format.

§Arguments
  • config - Format-specific configuration.
  • key_schema - Schema of the keys in the stream; only set for indexed Z-sets.
  • value_schema - Schema of the values in the stream. If the stream is an indexed Z-set, this is the schema of the values in the stream; if it is a Z-set, this is the schema of the keys in the stream.
  • consumer - Consumer to send encoded data batches to.
  • is_index - Whether the connector is configured with the index property.

is_index implies that key_schema is set. The inverse is not true: the stream may be an indexed Z-set; but the connector is not configured with the index property. The connector must iterate over the values in the stream either directly or using SerCursorFlattened.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§