saalfeldlab / n5-zarr

Zarr filesystem backend for N5
BSD 2-Clause "Simplified" License
12 stars 14 forks source link

Toward zarr implementation with KeyValueAccess #15

Closed bogovicj closed 1 year ago

bogovicj commented 1 year ago

see https://github.com/saalfeldlab/n5/tree/cache-attributes

bogovicj commented 1 year ago

Tests pass as of b08e033

bogovicj commented 1 year ago

Outstanding considerations:

Editing .zarray and .zgroup attributes

The current implementation does not yet have the ability to edit values in the .zarray and .zgroup files through the n5 api (setAttribute). Some parts of the previous implementation need to be added back here, but how it interacts with the new url functionality may need more consideration.

code duplication

There is some code duplication right now in [ZarrKeyValueWriter]()https://github.com/saalfeldlab/n5-zarr/blob/b08e0334a7ba0a27504d39e87f07ed61b463ecab/src/main/java/org/janelia/saalfeldlab/n5/zarr/ZarrKeyValueWriter.java) that I'd like to address.

This is because it currently extends N5KeyValueWriter so as not to duplicate the attribute caching, but it implements GsonZarrReader in order to get paths to zarr attributes and blocks.

As a result, some methods are currently in both ZarrKeyValueReader and ZarrKeyValueWriter. Will work on cleaning that up.

bogovicj commented 1 year ago

Note: we may need to require the GsonBuilder for Zarr uses serializeNulls, or get around the following issue in some other way:

Without serializeNulls on, raw compressors would not be serialized, i.e. no compressor key would exist despite it being required for .zarray metadata