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

Function zstd_reader

crates/snapshot/src/remote.rs:624–633  ·  view source on GitHub ↗

Create an [`AsyncZstdReader`] that incrementally decompresses the data fed to it via the returned [`mpsc::UnboundedSender`]. The reader implements [`tokio::io::AsyncRead`] and will indicate EOF once the sender is dropped and all remaining data in the channel has been consumed.

()

Source from the content-addressed store, hash-verified

622/// once the sender is dropped and all remaining data in the channel has been
623/// consumed.
624fn zstd_reader() -> io::Result<(
625 AsyncZstdReader<'static, impl AsyncBufRead>,
626 mpsc::UnboundedSender<Bytes>,
627)> {
628 let (tx, rx) = mpsc::unbounded_channel::<Bytes>();
629 let reader = StreamReader::new(UnboundedReceiverStream::new(rx).map(Ok::<_, io::Error>));
630 let zstd = AsyncZstdReader::builder_tokio(reader).build()?;
631
632 Ok((zstd, tx))
633}
634
635/// Newtype around [`blake3::Hasher`]
636/// that implements [`AsyncWrite`] and [`SatsWriter`].

Callers 2

fetch_blobMethod · 0.85
fetch_pageMethod · 0.85

Calls 4

newFunction · 0.50
OkFunction · 0.50
mapMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…