Skip to content

Commit

Permalink
Add support for the seekable format (#310)
Browse files Browse the repository at this point in the history
Support the seekable format through bindings to the upstream
functionality in zstd-safe. The seekable format can be activated with
the `seekable` feature flag.
  • Loading branch information
rorosen authored Jan 17, 2025
1 parent e515961 commit 21d79e8
Show file tree
Hide file tree
Showing 12 changed files with 1,193 additions and 1 deletion.
4 changes: 4 additions & 0 deletions zstd-safe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ arrays = []
no_asm = ["zstd-sys/no_asm"]
doc-cfg = []
zdict_builder = ["zstd-sys/zdict_builder"]
seekable = ["zstd-sys/seekable"]

# These two are for cross-language LTO.
# Will only work if `clang` is used to build the C library.
fat-lto = ["zstd-sys/fat-lto"]
thin-lto = ["zstd-sys/thin-lto"]

[lints.rust]
non_upper_case_globals = "allow"
6 changes: 6 additions & 0 deletions zstd-safe/src/constants_seekable.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file has been generated by ./update_consts.sh
pub const SEEKABLE_FRAMEINDEX_TOOLARGE: u64 = zstd_sys::ZSTD_SEEKABLE_FRAMEINDEX_TOOLARGE as u64;
pub const SEEKABLE_MAGICNUMBER: u32 = zstd_sys::ZSTD_SEEKABLE_MAGICNUMBER;
pub const SEEKABLE_MAX_FRAME_DECOMPRESSED_SIZE: u32 = zstd_sys::ZSTD_SEEKABLE_MAX_FRAME_DECOMPRESSED_SIZE;
pub const SEEKABLE_MAXFRAMES: u32 = zstd_sys::ZSTD_SEEKABLE_MAXFRAMES;
pub const seekTableFooterSize: u32 = zstd_sys::ZSTD_seekTableFooterSize;
6 changes: 6 additions & 0 deletions zstd-safe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ extern crate std;
#[cfg(test)]
mod tests;

#[cfg(feature = "seekable")]
pub mod seekable;

// Re-export zstd-sys
pub use zstd_sys;

Expand All @@ -48,6 +51,9 @@ include!("constants.rs");
#[cfg(feature = "experimental")]
include!("constants_experimental.rs");

#[cfg(feature = "seekable")]
include!("constants_seekable.rs");

/// Represents the compression level used by zstd.
pub type CompressionLevel = i32;

Expand Down
Loading

0 comments on commit 21d79e8

Please sign in to comment.