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

Please support seekable format #272

Open
joshtriplett opened this issue Apr 10, 2024 · 4 comments
Open

Please support seekable format #272

joshtriplett opened this issue Apr 10, 2024 · 4 comments

Comments

@joshtriplett
Copy link
Contributor

There's a seekable zstd format, which makes it possible to seek to and decompress segments independently. It includes a jump table at the end for all the segments.

https://github.com/facebook/zstd/blob/dev/contrib/seekable_format/zstd_seekable_compression_format.md

I'd love to have support for this format in zstd-rs, both to compress (with an API to mark the end of a segment) and to decompress (parsing the jump table and allowing decompression of individual segments).

@NobodyXu
Copy link
Contributor

There's a separate binding crate https://lib.rs/crates/zstd-seekable which can be used as a reference implementation

@x1957
Copy link

x1957 commented Oct 7, 2024

any updates?

@NobodyXu
Copy link
Contributor

NobodyXu commented Oct 8, 2024

cc @gyscos Are you interested in having this seekable zstd in this repository/crate?

Looking at the code, there's a ZSTD_seekable and ZSTD_seekable_compressor, so it looks like just two more bindings to add.

If it is just binding, then I could give it a shot.

@kylewlacy
Copy link

I've been interested in this issue. I originally tried using zstd-seekable, but it only works with sync readers. I also hit a bug / unintuitive behavior in the crate (maybe related to https://nest.pijul.com/pmeunier/zstd-seekable/discussions/1?). While trying to figure out how to solve that issue or contribute to it, I eventually looked into the seekable format more and realized that the format itself is dead simple

...so, I just published zstd-framed, which wraps zstd with a custom Rust implementation for the seekable format parts. It includes both sync and async reader and writer types.

Just wanted to chime in because I published the code under the Unlicense, so it should be pretty easy to adapt into this crate if anyone was interested (although probably with some tweaks to the interface-- I built something with lots of levers for my specific use case)

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

No branches or pull requests

4 participants