risingwave_connector::parser

Trait ByteStreamSourceParser

source
pub trait ByteStreamSourceParser:
    Send
    + Debug
    + Sized
    + 'static {
    // Required methods
    fn columns(&self) -> &[SourceColumnDesc];
    fn source_ctx(&self) -> &SourceContext;
    fn parser_format(&self) -> ParserFormat;
    fn parse_one<'a>(
        &'a mut self,
        key: Option<Vec<u8>>,
        payload: Option<Vec<u8>>,
        writer: SourceStreamChunkRowWriter<'a>,
    ) -> impl Future<Output = ConnectorResult<()>> + Send + 'a;

    // Provided methods
    fn parse_one_with_txn<'a>(
        &'a mut self,
        key: Option<Vec<u8>>,
        payload: Option<Vec<u8>>,
        writer: SourceStreamChunkRowWriter<'a>,
    ) -> impl Future<Output = ConnectorResult<ParseResult>> + Send + 'a { ... }
    fn emit_empty_row<'a>(&'a mut self, writer: SourceStreamChunkRowWriter<'a>) { ... }
}
Expand description

ByteStreamSourceParser is the entrypoint abstraction for parsing messages. It consumes bytes of one individual message and produces parsed records.

It’s used by ByteStreamSourceParserImpl::into_stream. pub is for benchmark only.

Required Methods§

source

fn columns(&self) -> &[SourceColumnDesc]

The column descriptors of the output chunk.

source

fn source_ctx(&self) -> &SourceContext

The source context, used to report parsing error.

source

fn parser_format(&self) -> ParserFormat

The format of the specific parser.

source

fn parse_one<'a>( &'a mut self, key: Option<Vec<u8>>, payload: Option<Vec<u8>>, writer: SourceStreamChunkRowWriter<'a>, ) -> impl Future<Output = ConnectorResult<()>> + Send + 'a

Parse one record from the given payload and write rows to the writer.

Returns error if any of the rows in the message failed to parse.

Provided Methods§

source

fn parse_one_with_txn<'a>( &'a mut self, key: Option<Vec<u8>>, payload: Option<Vec<u8>>, writer: SourceStreamChunkRowWriter<'a>, ) -> impl Future<Output = ConnectorResult<ParseResult>> + Send + 'a

Parse one record from the given payload, either write rows to the writer or interpret it as a transaction control message.

The default implementation forwards to ByteStreamSourceParser::parse_one for non-transactional sources.

Returns error if any of the rows in the message failed to parse.

source

fn emit_empty_row<'a>(&'a mut self, writer: SourceStreamChunkRowWriter<'a>)

Object Safety§

This trait is not object safe.

Implementors§