libzarr
Header-only C++17 Zarr v2/v3, WASM-compatible
Loading...
Searching...
No Matches
Classes | Functions | Variables
v3.hpp File Reference
#include <array>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <initializer_list>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "libzarr/detail/common.hpp"
#include "libzarr/metadata.hpp"
#include "libzarr/types.hpp"
#include "libzarr/v2.hpp"

Go to the source code of this file.

Classes

struct  zarr::v3::GroupMeta
 Result of parsing a v3 group zarr.json. More...
 

Functions

std::string zarr::v3::meta_key (const std::string &path)
 Store key of the metadata document for the node at path ("" = root).
 
DataType zarr::v3::parse_data_type (const json &v, const std::string &ctx)
 Parses a v3 data_type name. Extension (object) data types are rejected.
 
std::optional< Byteszarr::v3::parse_fill (const json &v, DataType dt, const std::string &ctx, bool lenient)
 Parses a v3 fill_value, dtype-directed (v3 core "Fill value" table).
 
ArrayMeta zarr::v3::parse_array_meta (const json &j, const std::string &ctx, bool lenient=false)
 Parses a v3 array zarr.json document into normalized ArrayMeta.
 
GroupMeta zarr::v3::parse_group_meta (const json &j, const std::string &ctx, bool lenient=false)
 Parses a v3 group zarr.json document.
 
std::string zarr::v3::chunk_key (const std::vector< std::uint64_t > &index, char separator)
 v3 chunk key relative to the array (v3 core "chunk key encoding").
 
std::string zarr::v3::emit_data_type (DataType dt)
 Emits the canonical v3 data_type name.
 
json zarr::v3::emit_fill (const std::optional< Bytes > &fill, DataType dt)
 
json zarr::v3::emit_array_meta (const ArrayMeta &meta)
 
json zarr::v3::emit_group_meta (const json &attributes)
 Emits canonical v3 group metadata.
 
void zarr::v3::consolidate (Store &store)
 

Variables

constexpr const char * zarr::v3::kMetaKey = "zarr.json"
 v3 metadata document name.
 

Detailed Description

Zarr v3 metadata (zarr.json): read-side parsing into normalized ArrayMeta. Strict by the v3.1 core spec (unrecognized members are errors) with an opt-in lenient mode; every deliberate read-tolerance cites its origin.

Function Documentation

◆ consolidate()

void zarr::v3::consolidate ( Store store)
inline

Builds (or rebuilds) the inline consolidated-metadata member of the root zarr.json from every v3 document in the store. Opt-in and explicit: the convention (zarr-specs #309) is not yet an accepted spec, so libzarr never writes it unasked.

◆ emit_array_meta()

json zarr::v3::emit_array_meta ( const ArrayMeta meta)
inline

Emits canonical v3 array metadata. Deterministic: fixed member set (empty attributes and absent dimension_names are omitted), sorted keys, stable forms. Shard levels fold back into nested sharding_indexed codecs.

◆ emit_fill()

json zarr::v3::emit_fill ( const std::optional< Bytes > &  fill,
DataType  dt 
)
inline

Emits a normalized fill as canonical v3 JSON. A missing fill (legal only on leniently-read metadata) is synthesized as zeros: v3 requires a concrete fill_value.