Registration system for chunk key encoding - #242
Merged
mkitti merged 2 commits intoMar 13, 2026
Merged
Conversation
Member
Author
|
See also https://github.com/mkitti/Zarr.jl/pull/2/changes for a similar registration system for codecs. |
…tration
Introduce `ChunkKeyEncodingEntry` struct pairing
`return_type::Type{<:AbstractChunkKeyEncoding}` with `parser::Function`,
replacing the bare `Dict{String, Function}` registry.
- `register_chunk_key_encoding(parser, name, ::Type{T}=AbstractChunkKeyEncoding)`
now stores a `ChunkKeyEncodingEntry` with the declared return type; the type
is the last (optional) argument to work naturally with do-block syntax
- `parse_chunk_key_encoding` asserts the result against `entry.return_type`
at runtime
- All built-in registrations updated with their specific concrete types
(`ChunkKeyEncoding` for "default" and "v2", `SuffixChunkKeyEncoding` for
"suffix")
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
|
We discussed the design at the March 12th meeting. |
mkitti
merged commit Mar 13, 2026
a54b2c9
into
JuliaIO:mkitti-abstract-chunk-key-encoding
16 checks passed
mkitti
added a commit
that referenced
this pull request
Mar 13, 2026
* Add AbstractChunkKeyEncoding, rename ChunkEncoding * Add constraint Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com> * chore: Update to new master * feat: Add SuffixChunkKeyEncoding * Registration system for chunk key encoding (#242) * Implement a registration system for chunk key encoding * refactor: Add typed ChunkKeyEncodingEntry to chunk key encoding registration Introduce `ChunkKeyEncodingEntry` struct pairing `return_type::Type{<:AbstractChunkKeyEncoding}` with `parser::Function`, replacing the bare `Dict{String, Function}` registry. - `register_chunk_key_encoding(parser, name, ::Type{T}=AbstractChunkKeyEncoding)` now stores a `ChunkKeyEncodingEntry` with the declared return type; the type is the last (optional) argument to work naturally with do-block syntax - `parse_chunk_key_encoding` asserts the result against `entry.return_type` at runtime - All built-in registrations updated with their specific concrete types (`ChunkKeyEncoding` for "default" and "v2", `SuffixChunkKeyEncoding` for "suffix") Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a pull request with a base of
mkitti-abstract-chunk-key-encodingwhich is currently #234 .This introduces
register_chunk_key_encodingas a method to add additional chunk key encodings. The intention is to abstract away some of the implementation details while mapping chunk key encoding names in JSON to constructor invocations.