MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / process_record

Function process_record

crates/commitlog/src/payload/txdata.rs:588–612  ·  view source on GitHub ↗
(
    visitor: &mut V,
    version: u8,
    tx_offset: u64,
    reader: &mut R,
    decode_txdata: F,
)

Source from the content-addressed store, hash-verified

586}
587
588fn process_record<'a, V, R, F, T>(
589 visitor: &mut V,
590 version: u8,
591 tx_offset: u64,
592 reader: &mut R,
593 decode_txdata: F,
594) -> Result<T, DecoderError<V::Error>>
595where
596 V: Visitor,
597 V::Row: Encode,
598 R: BufReader<'a>,
599 F: FnOnce(&mut V, &mut R) -> Result<T, V::Error>,
600{
601 if version > Txdata::<V::Row>::VERSION {
602 return Err(DecoderError::UnsupportedVersion {
603 supported: Txdata::<V::Row>::VERSION,
604 given: version,
605 });
606 }
607 visitor.visit_tx_start(tx_offset).map_err(DecoderError::Visitor)?;
608 let record = decode_txdata(visitor, reader).map_err(DecoderError::Visitor)?;
609 visitor.visit_tx_end().map_err(DecoderError::Visitor)?;
610
611 Ok(record)
612}
613
614#[cfg(test)]
615mod tests {

Callers 2

decode_record_fnFunction · 0.85
consume_record_fnFunction · 0.85

Calls 4

ErrFunction · 0.50
OkFunction · 0.50
visit_tx_startMethod · 0.45
visit_tx_endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…