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

Support streaming inputs in CLI tooling #1477

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

akoshelev
Copy link
Collaborator

This change does not integrate streaming into report collector yet as we're not quite ready for it. But it provides a means to split a BufRead interface into M streams that read from it one at a time. This should not require reading the entire file in memory in order to submit it.

There are a few things that I decided not to bring in the first version:

  • Reading from a file can be done in async runtime using AsyncRead interface. The benefit of it is not clear to me atm.
  • reading more than one line at a time. We could support reading lets say 8kb chunks from file and then let HTTP streams to stream it out.

This change does not integrate streaming into report collector yet as we're not quite ready for it. But it provides a means to split a `BufRead` interface into `M` streams that read from it one at a time. This should not require reading the entire file in memory in order to submit it.

There are a few things that I decided not to bring in the first version:

* Reading from a file can be done in async runtime using `AsyncRead` interface. The benefit of it is not clear to me atm.
* reading more than one line at a time. We could support reading lets say 8kb chunks from file and then let HTTP streams to stream it out.
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 98.73418% with 2 lines in your changes missing coverage. Please review.

Project coverage is 93.78%. Comparing base (cf7efd4) to head (0b26482).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
ipa-core/src/cli/playbook/streaming.rs 98.73% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1477      +/-   ##
==========================================
- Coverage   93.86%   93.78%   -0.08%     
==========================================
  Files         235      236       +1     
  Lines       42451    42837     +386     
==========================================
+ Hits        39845    40174     +329     
- Misses       2606     2663      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// but probably it does not matter for this code as it is not on the hot path
if state.idx == self.idx {
let poll = state.read_next();
if poll.is_ready() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

does read_next only return Poll::Ready?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, but only if it is ready, we want to advance the index

Copy link
Collaborator

@cberkhoff cberkhoff left a comment

Choose a reason for hiding this comment

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

Is reading just one line going to be slow?


proptest! {
#[test]
fn proptest_round_robin(input: Vec<String>, count in 1_usize..953) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this secret number?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nothing really, just something that is not large enough to cause proptests to run forever

@akoshelev akoshelev merged commit e667e78 into private-attribution:main Dec 5, 2024
12 checks passed
@akoshelev akoshelev deleted the rc-round-robin branch December 5, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants