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

Function segment_len

crates/fs-utils/src/compression.rs:232–242  ·  view source on GitHub ↗
(r: &mut T)

Source from the content-addressed store, hash-verified

230pub use async_impls::AsyncCompressReader;
231
232pub async fn segment_len<T: AsyncSeek + Unpin>(r: &mut T) -> tokio::io::Result<u64> {
233 use tokio::io::AsyncSeekExt;
234 let old_pos = r.stream_position().await?;
235 let len = r.seek(tokio::io::SeekFrom::End(0)).await?;
236 // If we're already at the end of the file, avoid seeking.
237 if old_pos != len {
238 r.seek(tokio::io::SeekFrom::Start(old_pos)).await?;
239 }
240
241 Ok(len)
242}
243
244mod async_impls {
245 use super::*;

Callers 3

file_sizeMethod · 0.85
segment_lenMethod · 0.85
segment_lenMethod · 0.85

Calls 2

OkFunction · 0.50
seekMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…