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§
sourcefn columns(&self) -> &[SourceColumnDesc]
fn columns(&self) -> &[SourceColumnDesc]
The column descriptors of the output chunk.
sourcefn source_ctx(&self) -> &SourceContext
fn source_ctx(&self) -> &SourceContext
The source context, used to report parsing error.
sourcefn parser_format(&self) -> ParserFormat
fn parser_format(&self) -> ParserFormat
The format of the specific parser.
sourcefn parse_one<'a>(
&'a mut self,
key: Option<Vec<u8>>,
payload: Option<Vec<u8>>,
writer: SourceStreamChunkRowWriter<'a>,
) -> impl Future<Output = ConnectorResult<()>> + Send + 'a
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§
sourcefn 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 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.