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 derive(Serialize, Deserialize) to DecompressorOxide #166

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dishmaker
Copy link

Fixes

I know this PR will not be merged, but it proves that state saving is actually possible!

Entire DecompressorOxide state compresses into only 356 bytes, for simple test case.

partial read len=32768
save at in_pos=11729
[miniz_oxide/tests/test_serde.rs:57:5] decompressor_state_msgpack.len() = 11824
[miniz_oxide/tests/test_serde.rs:58:5] decompressor_state_compressed.len() = 356
resume at in_pos=11729

So fast-seekable zip files are possible 😄

@oyvindln
Copy link
Collaborator

Could you leave leave the black_box change out of this PR? I would like to evaluate that separately.

I think adding a serde feature could be fine if there is a use for it though I would prefer if it's not enabled by default. Is it also possible to only enable the rmp_serde dev dependency conditionally?

@dishmaker dishmaker force-pushed the dishmaker/save_restore_decomp branch from 47ea42a to 36bd9da Compare February 20, 2025 12:34
@oyvindln
Copy link
Collaborator

Thanks for fixing the test part and splitting up the changes - will look over this and try to get it sorted when I have some time

@dishmaker
Copy link
Author

dishmaker commented Feb 28, 2025

Sorry for my ignorance.
There are better ways to achieve random access in zlib files. But not in zstd files.

@dishmaker dishmaker closed this Feb 28, 2025
@oyvindln
Copy link
Collaborator

oyvindln commented Mar 5, 2025

Ah okay - just took me some days to get around to this - would have been fine with adding serde support if it was useful otherwise.

@grant-h
Copy link

grant-h commented Mar 7, 2025

I'm currently working on a similar project to enable random access seekable ZIP files. I'm currently resorting maintaining a serde remote copy of the DecompressorOxide type. Would love to see this added and gated behind a feature flag to enable snapshot/restore of state.

@dishmaker dishmaker reopened this Mar 10, 2025
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