roboto.formats.mcap.fetch#

Module Contents#

roboto.formats.mcap.fetch.open_for_window(signed_url, start_time=None, end_time=None, topic_name=None)#

Open a remote MCAP file for reading, prefetching only the chunks in a log-time window and of one topic.

Reads the file’s summary section to locate its chunk index, then prefetches in parallel each chunk whose message log times intersect [start_time, end_time) and, given a topic_name, whose chunk index lists a message index for a channel of that topic. Later reads of those chunks are answered from the reader’s in-memory cache. The returned reader is positioned at the start of the file. The caller owns it and must close() it.

The window is matched against the chunk index’s log-time bounds; when row timestamps come from somewhere other than the message log time, pass no bounds (prefetching then covers every chunk) and filter rows after decode.

McapReader reads through mcap.reader.SeekingReader.iter_messages(), which picks chunks for a window and topic by the same log-time and channel rules, with one addition: when given topics, it also reads a chunk whose chunk index names no message index, since that chunk’s topics are unknown until it is scanned. This function does not prefetch such a chunk, so its bytes are downloaded when it is read.

Parameters:
  • signed_url (str) – Resolved download URL of the MCAP file.

  • start_time (Optional[int]) – Inclusive window lower bound in nanoseconds, or None for unbounded.

  • end_time (Optional[int]) – Exclusive window upper bound in nanoseconds, or None for unbounded.

  • topic_name (Optional[str]) – Prefetch only the chunks holding a message on an MCAP channel of this topic, or chunks of every topic when None.

Returns:

An HttpRangeReader over the file, primed with the selected chunks’ bytes and positioned at offset 0.

Return type:

roboto.storage.HttpRangeReader