MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / encode

Method encode

src/storage-types/src/controller.rs:361–375  ·  view source on GitHub ↗
(e: TxnsEntry)

Source from the content-addressed store, hash-verified

359 }
360
361 fn encode(e: TxnsEntry) -> (Self::Key, Self::Val) {
362 let row = match &e {
363 TxnsEntry::Register(data_id, ts) => Row::pack([
364 Datum::from(data_id.to_string().as_str()),
365 Datum::from(u64::from_le_bytes(*ts)),
366 Datum::Null,
367 ]),
368 TxnsEntry::Append(data_id, ts, batch) => Row::pack([
369 Datum::from(data_id.to_string().as_str()),
370 Datum::from(u64::from_le_bytes(*ts)),
371 Datum::from(batch.as_slice()),
372 ]),
373 };
374 (SourceData(Ok(row)), ())
375 }
376
377 fn decode(row: SourceData, _: ()) -> TxnsEntry {
378 let mut datums = row.0.as_ref().expect("valid entry").iter();

Callers

nothing calls this directly

Calls 5

packFunction · 0.85
SourceDataClass · 0.85
as_sliceMethod · 0.80
as_strMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected