-
Notifications
You must be signed in to change notification settings - Fork 412
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
Support decoding multiplexed RRD streams #7091
Conversation
pub struct Decoder<R: std::io::Read> { | ||
version: CrateVersion, | ||
compression: Compression, | ||
read: R, | ||
read: Reader<R>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever want to support unbuffered reads? Aren't those just strictly slower in almost all cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all cases -- if you're reading from an array of bytes, like we do in a bunch of places, adding extra buffering is pure waste of time and space.
/// This is particularly useful when working with stdio streams. | ||
/// | ||
/// If you're not familiar with multiplexed RRD streams, then you probably want to use | ||
/// [`Decoder::new`] instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need both constructors though? They look identical, except one requires a buffered reader.
Isn't it just better if we have one constructor that always handled concatenated streams?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three reasons:
- As mentioned above, buffering is a net loss is some real world cases that we depend on today.
- There's non negligible overhead to constantly check for unexpected
FileHeader
s, which there's really no reason to be paying for in most cases. - This is a very specific constructor that relies specifically on
std::io::BufReader
, as opposed to any type that implementsstd::io::BufRead
.
9533541
to
951ce6b
Compare
You can now do this: ``` cat docs/snippets/all/archetypes/*_rust.rrd | rerun rrd print ``` and this: ``` cat docs/snippets/all/archetypes/*_rust.rrd | rrd merge -o /tmp/all_merged.rrd ``` and this ``` cat docs/snippets/all/archetypes/*_rust.rrd | rerun rrd compact --max-rows 99999999 --max-bytes 999999999 -o /tmp/all_compacted_max.rrd ``` - Part of #7048 - DNM: requires #7091
TL;DR: the following is now possible:
This will of course become more interesting as you build more and more complex CLI pipelines with
rerun rrd
(Also fixed some missing buffered io while I was around.)
Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewerCHANGELOG.md
and the migration guideTo run all checks from
main
, comment on the PR with@rerun-bot full-check
.