From 00bc88fcc656f35ec052c8d3f3a9582057e28abb Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Thu, 5 Mar 2026 21:38:09 +0100 Subject: [PATCH] add prefix chunk key encoding --- chunk-key-encodings/prefix/README.md | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 chunk-key-encodings/prefix/README.md diff --git a/chunk-key-encodings/prefix/README.md b/chunk-key-encodings/prefix/README.md new file mode 100644 index 0000000..244acb1 --- /dev/null +++ b/chunk-key-encodings/prefix/README.md @@ -0,0 +1,51 @@ +# `prefix` Chunk Key Encoding + +## Summary + +This specification defines a chunk key encoding that prepends a constant string to the chunk keys produced by another chunk key encoding. + +## Metadata + +| field | type | required | +| - | - | - | +| `name` | Literal "prefix" | yes | +| `configuration` | [Configuration](#configuration) | yes | + +## Configuration + +| field | type | required | +| - | - | - | +| [`prefix`](#prefix) | string | yes | +| [`base_encoding`](#base-encoding) | chunk key encoding | yes | + +### `prefix` + +The `prefix` field is a string that is prepended to a chunk key generated by the chunk key encoding declared in the `base_encoding` field. + +The following constraints apply to the `prefix` field: +- `prefix` MUST NOT begin with `/`. +- `prefix` MUST NOT contain the substrings `..`, `\`, `\0`, or `//`. +- `prefix` MUST NOT contain the string `zarr.json`. +- `prefix` MUST NOT be the empty string. + +### `base_encoding` + +The `base_encoding` field is the metadata for another chunk key encoding. The output of this chunk key encoding is the base string to which the string declared by `prefix` is prepended. + +## Examples + +### x/ + +This configuration prepends `x/` to the key generated by the `v2` chunk key encoding with the default configuration (`separator` implicitly set to `.`). + +```json +{ + "name": "prefix", + "configuration": { + "prefix": "x/", + "base_encoding": "v2" + } +} +``` + +For a 3-dimensional array, the chunk at (0,0,0) would have the key `x/0.0.0`.