Skip to main content

vortex_zstd/
editions.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4//! The `zstd` edition family.
5//!
6//! Zstd buffer wrapping is opt-in. This module declares its persisted array encoding.
7
8use vortex_edition::Edition;
9use vortex_edition::EditionDeclaration;
10use vortex_edition::EditionFamily;
11use vortex_edition::EditionId;
12use vortex_edition::EditionMember;
13
14/// The `zstd` family: optional Zstd-backed serialized array representations.
15pub static FAMILY: EditionFamily = EditionFamily {
16    name: "zstd",
17    origin: "vortex-zstd",
18    doc: "Optional Zstd-backed serialized array representations. A reader built without \
19`vortex-zstd` cannot resolve these members, so they are versioned independently of `core` and \
20must be enabled explicitly by the caller.",
21};
22
23/// The February 2026 draft edition of the `zstd` family.
24pub const ZSTD_2026_02: EditionId = EditionId::new("zstd", 2026, 2, 0);
25
26/// The declaration of [`ZSTD_2026_02`] and the components that join the family at it.
27pub static DECLARATION: EditionDeclaration = EditionDeclaration {
28    edition: Edition {
29        id: ZSTD_2026_02,
30        min_library_version: None,
31    },
32    added: &[EditionMember::array(&"vortex.zstd_buffers")],
33};
34
35#[cfg(test)]
36mod tests {
37    use vortex_edition::EditionSessionExt;
38    use vortex_edition::test_harness::validate_edition;
39    use vortex_error::VortexResult;
40
41    use super::*;
42
43    #[test]
44    fn zstd_edition_is_valid() -> VortexResult<()> {
45        let session = vortex_array::array_session();
46        crate::initialize(&session);
47        validate_edition(&session.editions(), &ZSTD_2026_02)
48    }
49
50    #[test]
51    fn initialize_does_not_enable_zstd_edition() {
52        let session = vortex_array::array_session();
53        crate::initialize(&session);
54        assert!(
55            !session
56                .enabled_editions()
57                .editions()
58                .contains(&ZSTD_2026_02)
59        );
60    }
61}