Skip to main content

Parser

Trait Parser 

Source
pub trait Parser: Send + Sync {
    // Required methods
    fn parse(
        &mut self,
        data: &[u8],
        metadata: Option<ConnectorMetadata>,
    ) -> (Option<Box<dyn InputBuffer>>, Vec<ParseError>);
    fn stage(
        &self,
        buffers: Vec<Box<dyn InputBuffer>>,
    ) -> Box<dyn StagedBuffers>;
    fn splitter(&self) -> Box<dyn Splitter>;
    fn fork(&self) -> Box<dyn Parser>;
}
Expand description

Parses raw bytes into database records.

Required Methods§

Source

fn parse( &mut self, data: &[u8], metadata: Option<ConnectorMetadata>, ) -> (Option<Box<dyn InputBuffer>>, Vec<ParseError>)

Parses data into records and returns the records and any parse errors that occurred.

XXX it would be even better if this were &self and avoided keeping state entirely.

Source

fn stage(&self, buffers: Vec<Box<dyn InputBuffer>>) -> Box<dyn StagedBuffers>

Stages all of the buffers, which must have been obtained from this Parser or one forked from this one, into a StagedBuffers that may later be used to push the collected data into the circuit. See StagedBuffers for more information.

Source

fn splitter(&self) -> Box<dyn Splitter>

Returns an object that can be used to break a stream of incoming data into complete records to pass to Parser::parse.

Source

fn fork(&self) -> Box<dyn Parser>

Create a new parser with the same configuration as self.

Used by multithreaded transport endpoints to create multiple parallel input pipelines.

Implementors§