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

Rust: Port anduril/mcap-rs #611

Merged
merged 10 commits into from
Sep 30, 2022
Merged

Rust: Port anduril/mcap-rs #611

merged 10 commits into from
Sep 30, 2022

Conversation

mrkline
Copy link
Contributor

@mrkline mrkline commented Sep 26, 2022

Public-Facing Changes

Description

Adds a more fully-featured Rust library that supports indexed reading, CRC validation, record writing, chunking, and automatic summary writing.

TODOs

  • Spelling (Clear up spelling issues in Rust library #618)
  • We probably want to make serde an optional dependency that we only pull in for the conformance reader. (I can't imagine users wanting to serialize random chunks of an MCAP file to JSON/CBOR/Bincode/etc.)
  • The round-trip test (tests/round_trip.rs) checks the message indexes by individually seeking each message from its respective chunk. This is... slow. Should we axe that part of the test to avoid bogging down CI?

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2022

CLA assistant check
All committers have signed the CLA.

@mrkline mrkline force-pushed the anduril-rust branch 3 times, most recently from 9f4265f to 247221d Compare September 26, 2022 23:20
rust/src/records.rs Outdated Show resolved Hide resolved
rust/src/records.rs Outdated Show resolved Hide resolved
- Make field names match.
- Extract chunks.
- Flatten record headers.
- Skip data_len header fields
Duplicated data invites inconsistency - the slices we return for
schemas, messages, and attachments know their length.

Inside the codec, just serialize the length fields separately.
@mrkline mrkline marked this pull request as ready for review September 28, 2022 06:45
@mrkline mrkline changed the title WIP: Port anduril/mcap-rs Rust: Port anduril/mcap-rs Sep 28, 2022
@mrkline mrkline requested a review from james-rms September 28, 2022 06:48
rust/README.md Outdated
@@ -1,31 +1,18 @@
# Rust MCAP reading library
# mcap-rs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of date?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Thanks, fixed in ae22506

}

// Hard mode: randomly access every message in the MCAP.
// Yes, this is dumb and O(n^2).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 minute CI isn't a terrible situation - with this test rust is the long pole, taking the crown from C++ (5 mins). I think we can speed this up a little by writing a custom MCAP with only 10 messages as part of this test instead of using demo.mcap. Happy to do that as a separate PR.

Copy link
Collaborator

@james-rms james-rms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: serde as an optional dependency, I think this is impossible without duplicating a large amount of record struct declaration. Probably the right path there is to just write a manual transformation from serde_json::Value objects to Records.

@james-rms james-rms merged commit 602f274 into foxglove:main Sep 30, 2022
@james-rms james-rms mentioned this pull request Oct 3, 2022
@amacneil
Copy link
Contributor

amacneil commented Oct 5, 2022

👏 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants