Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-side chunks 2: introduce TransportChunk #6439

Merged
merged 4 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions crates/re_chunk/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub type ChunkId = re_tuid::Tuid;
/// Its time columns might or might not be ascendingly sorted, depending on how the data was logged.
///
/// This is the in-memory representation of a chunk, optimized for efficient manipulation of the
/// data within.
/// data within. For transport, see [`crate::TransportChunk`] instead.
#[derive(Debug, Clone)]
pub struct Chunk {
pub(crate) id: ChunkId,
Expand Down Expand Up @@ -337,7 +337,16 @@ impl Chunk {
}
}

// TODO(cmc): display impl
impl std::fmt::Display for Chunk {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let chunk = self.to_transport().map_err(|err| {
re_log::error_once!("couldn't display Chunk: {err}");
std::fmt::Error
})?;
chunk.fmt(f)
}
}

// TODO(cmc): sizebytes impl + sizebytes caching + sizebytes in transport metadata

Expand Down
2 changes: 2 additions & 0 deletions crates/re_chunk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

mod chunk;
mod shuffle;
mod transport;
mod util;

pub use self::chunk::{Chunk, ChunkError, ChunkId, ChunkResult, ChunkTimeline};
pub use self::transport::TransportChunk;
pub use self::util::arrays_to_list_array;

pub mod external {
Expand Down
6 changes: 3 additions & 3 deletions crates/re_chunk/src/shuffle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ mod tests {
components.clone().into_iter().collect(),
)?;

// eprintln!("{chunk_sorted}");
eprintln!("{chunk_sorted}");

assert!(chunk_sorted.is_sorted());
assert!(chunk_sorted.is_sorted_uncached());
Expand All @@ -308,7 +308,7 @@ mod tests {
chunk_shuffled
};

// eprintln!("{chunk_shuffled}");
eprintln!("{chunk_shuffled}");

assert!(!chunk_shuffled.is_sorted());
assert!(!chunk_shuffled.is_sorted_uncached());
Expand All @@ -320,7 +320,7 @@ mod tests {
chunk_resorted
};

// eprintln!("{chunk_resorted}");
eprintln!("{chunk_resorted}");

assert!(chunk_resorted.is_sorted());
assert!(chunk_resorted.is_sorted_uncached());
Expand Down
Loading
Loading