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

Expose total_in/total_out from underlying flate2 encoder types. #278

Merged
merged 1 commit into from
May 28, 2024

Conversation

tobz
Copy link
Contributor

@tobz tobz commented May 28, 2024

👋🏻

This PR is about exposing some more of the underlying flate2 bits, as the title indicates.

Naturally, when asynchronously writing the compressed output, it can be difficult, otherwise, to determine how much data has been written so far. By exposing the helper methods like total_in and total_out, it becomes that much easier.

Some thoughts/caveats:

  • I do realize that this is somewhat coupling the API to flate2, although with flate2 being 1.x, it should be OK from a stability standpoint.
  • Not all compression algorithms used come from flate2, so not all encoders can consistently expose these same methods.

@robjtede
Copy link
Member

Exposing a useful -> u64 getter doesn't feel like it's exposing internals too much. I'd be comfortable committing to this API. Will wait for consensus before merging though.

@NobodyXu
Copy link
Collaborator

the API looks fine to me, exposing the total in/out as u64 seems reasonable for me.

Can't think of a reason to use another type, i.e. negative total in/out doesn't make sense, and total in/out should be always available.

@robjtede robjtede added this pull request to the merge queue May 28, 2024
Merged via the queue into Nullus157:main with commit fd77c55 May 28, 2024
16 checks passed
@tobz tobz deleted the tobz/expose-encoder-stats-methods branch May 30, 2024 18:53
@tobz
Copy link
Contributor Author

tobz commented May 30, 2024

Oh wow, awesome!

Thanks so much y'all.

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