pub struct Summary<'a> {
pub stats: Option<Statistics>,
pub channels: HashMap<u16, Arc<Channel<'a>>>,
pub schemas: HashMap<u16, Arc<Schema<'a>>>,
pub chunk_indexes: Vec<ChunkIndex>,
pub attachment_indexes: Vec<AttachmentIndex>,
pub metadata_indexes: Vec<MetadataIndex>,
}
Expand description
Indexes of an MCAP file parsed from its (optional) summary section
Fields§
§stats: Option<Statistics>
§channels: HashMap<u16, Arc<Channel<'a>>>
Maps channel IDs to their channel
schemas: HashMap<u16, Arc<Schema<'a>>>
Maps schema IDs to their schema
chunk_indexes: Vec<ChunkIndex>
§attachment_indexes: Vec<AttachmentIndex>
§metadata_indexes: Vec<MetadataIndex>
Implementations§
source§impl<'a> Summary<'a>
impl<'a> Summary<'a>
sourcepub fn read(mcap: &'a [u8]) -> McapResult<Option<Self>>
pub fn read(mcap: &'a [u8]) -> McapResult<Option<Self>>
Read the summary section of the given mapped MCAP file, if it has one.
sourcepub fn stream_chunk(
&self,
mcap: &'a [u8],
index: &ChunkIndex
) -> McapResult<impl Iterator<Item = McapResult<Message<'a>>> + '_>
pub fn stream_chunk( &self, mcap: &'a [u8], index: &ChunkIndex ) -> McapResult<impl Iterator<Item = McapResult<Message<'a>>> + '_>
Stream messages from the chunk with the given index.
To avoid having to read all preceding chunks first, channels and their schemas are pulled from this summary.
sourcepub fn read_message_indexes(
&self,
mcap: &[u8],
index: &ChunkIndex
) -> McapResult<HashMap<Arc<Channel<'_>>, Vec<MessageIndexEntry>>>
pub fn read_message_indexes( &self, mcap: &[u8], index: &ChunkIndex ) -> McapResult<HashMap<Arc<Channel<'_>>, Vec<MessageIndexEntry>>>
Read the mesage indexes for the given indexed chunk.
Channels and their schemas are pulled from this summary.
The offsets in each MessageIndexEntry
is relative to the decompressed contents of the given chunk.
sourcepub fn seek_message(
&self,
mcap: &'a [u8],
index: &ChunkIndex,
message: &MessageIndexEntry
) -> McapResult<Message<'_>>
pub fn seek_message( &self, mcap: &'a [u8], index: &ChunkIndex, message: &MessageIndexEntry ) -> McapResult<Message<'_>>
Seek to the given message in the given indexed chunk.
If you’re interested in more than a single message from the chunk,
filtering Summary::stream_chunk
is probably a better bet.
Compressed chunks aren’t random access -
this decompresses everything in the chunk before
message.offset
and throws it away.