Skip to content

Conversation

@mannreis
Copy link
Contributor

@mannreis mannreis commented Dec 4, 2025

This PR follows up on #3219 :

  • Adds libnczarr/zmetadata.h to the code base and to the build systems
  • Introduces the metadata field of type struct NCZ_Metadata in NCZ_FILE_INFO_T

@DennisHeimbigner
Copy link
Collaborator

I am curious. I am comparing the zmetadata dispatcher operation from zarr-csl-2
and the original one I had from long ago.
The dispatcher API for zarr-csl-2 is basically this:

int (*list_nodes)(struct NCZ_FILE_INFO*, const char * key, NClist *groups, NClist *vars);
int (*list_groups)(struct NCZ_FILE_INFO*, const char * key, NClist *subgrpnames);
int (*list_variables)(struct NCZ_FILE_INFO*, const char * key, NClist *varnames);
int (*fetch_json_content)(struct NCZ_FILE_INFO*, NCZMD_MetadataType, const char *name, NCjson **jobj);
int (*update_json_content)(struct NCZ_FILE_INFO*, NCZMD_MetadataType, const char *name, const NCjson *jobj);
int (*validate_consolidated)(const NCjson *jobj);

The set I originally used was this:

int (*open)(NC_FILE_INFO_T* file);
int (*create)(NC_FILE_INFO_T* file);
int (*close)(NC_FILE_INFO_T* file);
int (*consolidate)(NC_FILE_INFO_T* file);
int (*fetch_json_content)(NC_FILE_INFO_T *, NCZMD_MetadataType, const char* key, NCjson** jobj);
int (*update_json_content)(NC_FILE_INFO_T *, NCZMD_MetadataType, const char *key, const NCjson *jobj);
/* zmap wrappers */
int (*list)(NC_FILE_INFO_T*, const char* prefix, NClist* matches);
int (*listall)(NC_FILE_INFO_T*, const char* prefix, NClist* matches);
int (*exists)(NC_FILE_INFO_T* file, const char* prefix);

The only two that match as such are fetch_json_content and update_json_content.
So I am trying to match the other function semantics.
Can you give me short 1-2 line description of what your other dispatch API functions do?

@mannreis
Copy link
Contributor Author

mannreis commented Dec 6, 2025

Indeed they are a bit different but not that much. The on you wrote implements the metadata layer as sort of a storage layer and it actually is/uses it. However I consider that approach distances itself a bit away to the Zarr concepts.

I added list_nodes, list_groups, and list_variables but in reality only the first is going to be used.
They basically will either check what groups and/or variables exist on the storage for the no consolidaded case, or provide the same information by parsing the zmetadata content for the consolidated case.

Lastly the validade_consolidated will be a noop for the non consolidated case, and will check if the JSON passed is compliant to what we expect. It will be used with selecting the handler in the case that .zmetadata is corrupted and we can fallback to the non consolidated handler

@DennisHeimbigner
Copy link
Collaborator

Thanks, that is helpful.

@mannreis
Copy link
Contributor Author

Tests need to be re-triggered because of the intermittent issue with dap4_test_test_remote.

WardF
WardF previously approved these changes Dec 11, 2025
@mannreis mannreis dismissed WardF’s stale review December 11, 2025 18:11

The merge-base changed after approval.

@WardF WardF self-assigned this Dec 11, 2025
@WardF WardF merged commit 0f4184f into Unidata:main Dec 11, 2025
116 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants