Zarr v2 and v3 chunked array storage for MoonBit
Dependencies
| Capability | Zarr v2 | Zarr v3 |
|---|---|---|
| Parse regular-grid array metadata | Yes, common string dtypes | Yes, common string data types |
| Metadata and chunk keys | . and / separators | default and v2-compatible encodings |
| Raw encoded chunk storage | Memory and native filesystem | Memory and native filesystem |
| Safe single-key filesystem replacement | Native: exclusive sibling staging + replace | Native: exclusive sibling staging + replace |
| bool element and slice I/O | Memory and native filesystem | Memory and native filesystem; bytes codec |
| uint8 element and slice I/O | Memory and native filesystem; C/F order | Memory and native filesystem; bytes codec |
| int8 element and slice I/O (Int API, range-checked) | Memory and native filesystem; C/F order | Memory and native filesystem; bytes codec |
| uint16 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| int16 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| uint32 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| float64 element I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| float32 element I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| int32 element I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| int64 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| uint64 element and slice I/O | Memory and native filesystem; little/big endian, C/F order | Memory and native filesystem; little/big endian bytes codec |
| Rectangular slice I/O (all listed types) | Memory and native filesystem | Memory and native filesystem |
| gzip compression (levels 0–9) | Read/write | Read/write after bytes codec |
| zstd compression (levels 0–22) | Read/write | Read/write after bytes codec, with or without frame checksum |
| zlib compression (levels 0–9) | Read/write | Not a v3 core codec |
| Blosc1 frames (LZ4/LZ4HC/Zlib/Zstd; no, byte or bit shuffle) | LZ4 read/write; LZ4HC/Zlib/Zstd read-only; BloscLZ unsupported | LZ4 read/write after bytes codec; LZ4HC/Zlib/Zstd read-only; BloscLZ unsupported |
| Other dtypes, filters and codecs | Planned | Planned |
| Groups, ancestors and attributes | Memory and native filesystem (.zgroup/.zattrs) | Memory and native filesystem (zarr.json) |
| Consolidated metadata | Read-only native .zmetadata snapshot | Read-only native inline root zarr.json snapshot (zarr-python convention) |
| HTTP read-only regional hydration | Native, bounded metadata/chunk downloads | Native, bounded metadata/chunk downloads |
| Sharding-indexed codec | Not a v2 codec | Native filesystem reads only: start/end index, little/big-endian index, optional CRC32C, supported inner bytes/compression codecs; no writes or HTTP/memory hydration |
| Cloud object-store adapters | Planned | Planned |
moon add zlhahaha/zarr@0.6.0moon add moonbitlang/async@0.20.3git clone https://github.com/zlhahaha/zarr.git
cd zarr
moon update
moon run --target wasm-gc cmd/main
moon run --target native cmd/native_demo
moon run --target native cmd/v2_demo
moon run --target native cmd/budget_demo
moon run --target native cmd/nd_demomoon check --target native --deny-warn
moon build --target native
moon test --target native --deny-warn
moon check --target wasm-gc --deny-warn
moon build --target wasm-gc
moon test --target wasm-gc --deny-warn
moon run --target wasm-gc cmd/main
moon run --target native cmd/native_demo
moon run --target native cmd/v2_demometadata/ Parse and validate v2/v3 array and group documents
chunk/ Regular-grid indexing and metadata/chunk keys
shard/ V3 sharding layout and bounded index validation
dtype/ Numeric dtype and fill-value checks
codec/ Codec-chain validation and bounded gzip/zlib/zstd decode
store/ In-memory encoded-byte store
store/fs/ Native-only filesystem store
store/http/ Native-only read-only HTTP regional hydration
array/ Typed array creation, element and region I/O
hierarchy/ Group and attribute operations
integration/ Cross-package tests
cmd/main/ Portable in-memory v3 example
cmd/native_demo/ Native filesystem v3 example
cmd/v2_demo/ Native filesystem v2 example
cmd/budget_demo/ Native read-budget rejection and recovery example
cmd/nd_demo/ Native 3D image / 4D feature-tensor example
cmd/nd_interop/ N-D reverse interoperability generator
cmd/benchmark/ Native read latency and OS peak-memory instrumentation
scripts/ Independent data generation, interoperability and benchmarksInstall
Download zipZarr v2 and v3 chunked array storage for MoonBit
Dependencies