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

Implement LZ4 decompression for 1.20.5+ #108

Merged
merged 1 commit into from May 12, 2024
Merged

Conversation

Badel2
Copy link
Contributor

@Badel2 Badel2 commented Apr 5, 2024

Close #101

At first I tried using lz4_flex directly, but that doesn't work because java uses a different format. Then I searched "lz4 java" in crates.io and I found this nice crate that implements exactly what we need.

We need a Lz4DecoderWrapper because the API of that crate is not the same as the gzip crates. This introduces an additional copy but I believe the only way to avoid that would be to change the interface of the read_compressed_chunk function.

Tested by generating a world using a server with region-file-compression=lz4, and using the region-dump binary to test decompressing it.

@owengage
Copy link
Owner

owengage commented Apr 9, 2024

Sorry I've not gotten around to looking at this yet.

From a brief look, my gut says I'd rather depend only on the lz4 dep directly and implement the layers on top directly. Mainly just to reduce dependencies. But that depends just how complex that would be.

@Badel2
Copy link
Contributor Author

Badel2 commented Apr 9, 2024

Well I have no interest in learning about the implementation details of lz4, and copying that dependency as a new module would be pointless, so if you or someone else wants to work on that then nice, and if not then you can always use this pull request :)

No rush on my side as most worlds will not use this compression format yet.

@owengage
Copy link
Owner

Hey, I've still not got around to looking at this more closely. I'm going to go with this as is. I can always spend the time in future if I really care about the dependencies.

Thanks again for your contributions, it's appreciated.

@owengage owengage merged commit ad0e8d8 into owengage:master May 12, 2024
1 check passed
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.

Handle LZ4 chunk compression
2 participants