pub trait Visitor {
type Error: From<DecodeError>;
type Row;
// Required methods
fn visit_insert<'a, R: BufReader<'a>>(
&mut self,
table_id: TableId,
reader: &mut R,
) -> Result<Self::Row, Self::Error>;
fn visit_delete<'a, R: BufReader<'a>>(
&mut self,
table_id: TableId,
reader: &mut R,
) -> Result<Self::Row, Self::Error>;
fn skip_row<'a, R: BufReader<'a>>(
&mut self,
table_id: TableId,
reader: &mut R,
) -> Result<(), Self::Error>;
// Provided methods
fn visit_truncate(&mut self, _table_id: TableId) -> Result<(), Self::Error> { ... }
fn visit_tx_start(&mut self, _offset: u64) -> Result<(), Self::Error> { ... }
fn visit_tx_end(&mut self) -> Result<(), Self::Error> { ... }
fn visit_inputs(&mut self, _inputs: &Inputs) -> Result<(), Self::Error> { ... }
fn visit_outputs(&mut self, _outputs: &Outputs) -> Result<(), Self::Error> { ... }
}Expand description
A visitor useful to implement stateful super::Decoders of Txdata payloads.
Required Associated Types§
type Error: From<DecodeError>
Sourcetype Row
type Row
The type corresponding to one element in Ops::rowdata.
Required Methods§
Sourcefn visit_insert<'a, R: BufReader<'a>>(
&mut self,
table_id: TableId,
reader: &mut R,
) -> Result<Self::Row, Self::Error>
fn visit_insert<'a, R: BufReader<'a>>( &mut self, table_id: TableId, reader: &mut R, ) -> Result<Self::Row, Self::Error>
Called for each row in each Ops of a Mutations’ inserts.
The implementation is expected to determine the appropriate schema based
on the supplied TableId, and to decode the row data from the
supplied BufReader.
The reader’s position is assumed to be at the start of the next row after the method returns.
Sourcefn visit_delete<'a, R: BufReader<'a>>(
&mut self,
table_id: TableId,
reader: &mut R,
) -> Result<Self::Row, Self::Error>
fn visit_delete<'a, R: BufReader<'a>>( &mut self, table_id: TableId, reader: &mut R, ) -> Result<Self::Row, Self::Error>
Called for each row in each Ops of a Mutations’ deletes.
Similar to Self::visit_insert, but allows the visitor to determine
the start of the next section in a Mutations payload.
Sourcefn skip_row<'a, R: BufReader<'a>>(
&mut self,
table_id: TableId,
reader: &mut R,
) -> Result<(), Self::Error>
fn skip_row<'a, R: BufReader<'a>>( &mut self, table_id: TableId, reader: &mut R, ) -> Result<(), Self::Error>
Called to skip over rows from reader within a Mutations of a TX that should not be folded.
Takes &mut self because schema lookups may need mutable access to the visitor
in order to memoize the computed schema.
This method should not store or use the row in any way.
Provided Methods§
Sourcefn visit_tx_start(&mut self, _offset: u64) -> Result<(), Self::Error>
fn visit_tx_start(&mut self, _offset: u64) -> Result<(), Self::Error>
Called for each Txdata record in a crate::Commit.
The default implementation does nothing.
Sourcefn visit_tx_end(&mut self) -> Result<(), Self::Error>
fn visit_tx_end(&mut self) -> Result<(), Self::Error>
Called after each successful decode of a Txdata payload.
The default implementation does nothing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.