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

Add into_inner() on Rust writer #1314

Merged
merged 2 commits into from
Jan 20, 2025
Merged

Add into_inner() on Rust writer #1314

merged 2 commits into from
Jan 20, 2025

Conversation

Muon
Copy link
Contributor

@Muon Muon commented Jan 20, 2025

Changelog

Add an into_inner() method on the Rust writer to get back the underlying stream.

Docs

https://linear.app/foxglove/issue/FG-9969/[rust-sdk]-cant-close-mcap-writer

Description

Some I/O errors only show up when the output file is closed. This change allows users to check for such errors.

Fixes: FG-9969

Copy link

linear bot commented Jan 20, 2025

.finalize()
.0
.finish()
.expect("compression error")
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to have this here instead of returning a result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It's because of the zstd compressor. I'll add a comment to clarify.

Copy link
Collaborator

Choose a reason for hiding this comment

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

what if we swallowed the error instead? The caller is already expecting to not get a complete MCAP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've rejigged it to avoid the unwrap entirely by using the interface in zio::Writer instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@james-rms swallowing wasn't an option because the wrapper interface wouldn't even let you get the W back unless finishing succeeded.

@Muon Muon force-pushed the mak/rust-writer-into_inner branch from 6a19bdb to d2cfc83 Compare January 20, 2025 04:26
@Muon Muon merged commit b1380d3 into main Jan 20, 2025
23 checks passed
@Muon Muon deleted the mak/rust-writer-into_inner branch January 20, 2025 04:34
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.

3 participants