Low-level C API

Zarrs.LibZarrs is a thin wrapper around the C API of the zarrs_jl Rust library. It is internal and may change between releases; use the high-level API instead.

The module is generated by gen/generator.jl from deps/zarrs_jl/zarrs_jl.h, which is itself generated from the Rust sources with cbindgen. After changing an extern "C" function in deps/zarrs_jl/src/, regenerate both files with Julia 1.13 (the version CI uses; gen/Manifest.toml pins the generator's dependencies):

cargo install cbindgen --version "$(cat gen/cbindgen-version)" --locked
julia --project=gen -e 'using Pkg; Pkg.instantiate()'
julia --project=gen gen/generator.jl

CI fails if the committed files do not match the regenerated output.

Zarrs.LibZarrs.zarrs_array_get_chunk_origin — Method
zarrs_array_get_chunk_origin(array, dimensionality, pChunkIndices, pChunkOrigin)

Prototype

ZarrsResult zarrsArrayGetChunkOrigin(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pChunkIndices, uint64_t *pChunkOrigin);
source
Zarrs.LibZarrs.zarrs_array_get_chunk_shape — Method
zarrs_array_get_chunk_shape(array, dimensionality, pChunkIndices, pChunkShape)

Prototype

ZarrsResult zarrsArrayGetChunkShape(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pChunkIndices, uint64_t *pChunkShape);
source
Zarrs.LibZarrs.zarrs_array_get_chunk_size — Method
zarrs_array_get_chunk_size(array, dimensionality, pChunkIndices)

Prototype

ZarrsResult zarrsArrayGetChunkSize(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pChunkIndices, uintptr_t *pChunkSize);
source
Zarrs.LibZarrs.zarrs_array_get_sub_chunk_shape — Method
zarrs_array_get_sub_chunk_shape(array, dimensionality, pIsSharded, pSubChunkShape)

Prototype

ZarrsResult zarrsArrayGetSubChunkShape(ArrayHandle *array, uintptr_t dimensionality, int32_t *pIsSharded, uint64_t *pSubChunkShape);
source
Zarrs.LibZarrs.zarrs_array_get_subset_size — Method
zarrs_array_get_subset_size(array, dimensionality, pSubsetShape)

Prototype

ZarrsResult zarrsArrayGetSubsetSize(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pSubsetShape, uintptr_t *pSubsetSize);
source
Zarrs.LibZarrs.zarrs_array_retrieve_chunk — Method
zarrs_array_retrieve_chunk(array, dimensionality, pChunkIndices, chunkBytesCount, pChunkBytes)

Prototype

ZarrsResult zarrsArrayRetrieveChunk(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pChunkIndices, uintptr_t chunkBytesCount, uint8_t *pChunkBytes);
source
Zarrs.LibZarrs.zarrs_array_retrieve_subset — Method
zarrs_array_retrieve_subset(array, dimensionality, pSubsetStart, pSubsetShape, subsetBytesCount, pSubsetBytes)

Prototype

ZarrsResult zarrsArrayRetrieveSubset(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pSubsetStart, const uint64_t *pSubsetShape, uintptr_t subsetBytesCount, uint8_t *pSubsetBytes);
source
Zarrs.LibZarrs.zarrs_array_store_chunk — Method
zarrs_array_store_chunk(array, dimensionality, pChunkIndices, chunkBytesCount, pChunkBytes)

Prototype

ZarrsResult zarrsArrayStoreChunk(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pChunkIndices, uintptr_t chunkBytesCount, const uint8_t *pChunkBytes);
source
Zarrs.LibZarrs.zarrs_array_store_subset — Method
zarrs_array_store_subset(array, dimensionality, pSubsetStart, pSubsetShape, subsetBytesCount, pSubsetBytes)

Prototype

ZarrsResult zarrsArrayStoreSubset(ArrayHandle *array, uintptr_t dimensionality, const uint64_t *pSubsetStart, const uint64_t *pSubsetShape, uintptr_t subsetBytesCount, const uint8_t *pSubsetBytes);
source
Zarrs.LibZarrs.zarrs_create_array_rw — Method
zarrs_create_array_rw(storage, path, metadata_json)

Prototype

ZarrsResult zarrsCreateArrayRW(StorageHandle *storage, const char *path, const char *metadata_json, ArrayHandle **pArray);
source
Zarrs.LibZarrs.zarrs_create_group_rw — Method
zarrs_create_group_rw(storage, path, metadata_json)

Prototype

ZarrsResult zarrsCreateGroupRW(StorageHandle *storage, const char *path, const char *metadata_json, GroupHandle **pGroup);
source
Zarrs.LibZarrs.zarrs_create_storage_gcs — Method
zarrs_create_storage_gcs(bucket, prefix, anonymous)

Prototype

ZarrsResult zarrsCreateStorageGCS(const char *bucket, const char *prefix, int32_t anonymous, StorageHandle **pStorage);
source
Zarrs.LibZarrs.zarrs_create_storage_s3 — Method
zarrs_create_storage_s3(bucket, prefix, region, endpoint_url, anonymous)

Prototype

ZarrsResult zarrsCreateStorageS3(const char *bucket, const char *prefix, const char *region, const char *endpoint_url, int32_t anonymous, StorageHandle **pStorage);
source
Zarrs.LibZarrs.zarrs_icechunk_azure_storage — Method
zarrs_icechunk_azure_storage(account, container, prefix, credential_type, credential_value)

Prototype

ZarrsResult zarrsIcechunkAzureStorage(const char *account, const char *container, const char *prefix, int32_t credential_type, const char *credential_value, IcStorageHandle **pHandle);
source
Zarrs.LibZarrs.zarrs_icechunk_gcs_storage — Method
zarrs_icechunk_gcs_storage(bucket, prefix, credential_type, credential_value)

Prototype

ZarrsResult zarrsIcechunkGcsStorage(const char *bucket, const char *prefix, int32_t credential_type, const char *credential_value, IcStorageHandle **pHandle);
source
Zarrs.LibZarrs.zarrs_icechunk_readonly_session — Method
zarrs_icechunk_readonly_session(repo, version_type, version_value)

Create a readonly session. version_type: 0 = branch, 1 = tag, 2 = snapshot_id version_value: the branch name, tag name, or snapshot ID string

Prototype

ZarrsResult zarrsIcechunkReadonlySession(IcRepoHandle *repo, int32_t version_type, const char *version_value, IcSessionHandle **pSession);
source
Zarrs.LibZarrs.zarrs_icechunk_s3_storage — Method
zarrs_icechunk_s3_storage(bucket, prefix, region, anonymous, endpoint_url, allow_http, access_key_id, secret_access_key, session_token)

Prototype

ZarrsResult zarrsIcechunkS3Storage(const char *bucket, const char *prefix, const char *region, int32_t anonymous, const char *endpoint_url, int32_t allow_http, const char *access_key_id, const char *secret_access_key, const char *session_token, IcStorageHandle **pHandle);
source
Zarrs.LibZarrs.zarrs_icechunk_session_commit — Method
zarrs_icechunk_session_commit(session, message)

Commit a writable session with a message, returning a snapshot ID string.

Prototype

ZarrsResult zarrsIcechunkSessionCommit(IcSessionHandle *session, const char *message, char **pSnapshotId);
source
Zarrs.LibZarrs.zarrs_icechunk_session_get_storage — Method
zarrs_icechunk_session_get_storage(session)

Create a zarrs-compatible StorageHandle from an Icechunk session. This bridges the Icechunk Store to the zarrs sync storage interface.

Prototype

ZarrsResult zarrsIcechunkSessionGetStorage(IcSessionHandle *session, StorageHandle **pStorage);
source
Zarrs.LibZarrs.zarrs_icechunk_writable_session — Method
zarrs_icechunk_writable_session(repo, branch)

Create a writable session on a branch.

Prototype

ZarrsResult zarrsIcechunkWritableSession(IcRepoHandle *repo, const char *branch, IcSessionHandle **pSession);
source
Zarrs.LibZarrs.zarrs_jl_array_erase_chunk — Method
zarrs_jl_array_erase_chunk(storage, path, ndim, indices)

Erase a specific chunk from an array.

Prototype

ZarrsResult zarrsJlArrayEraseChunk(StorageHandle *storage, const char *path, uintptr_t ndim, const uint64_t *indices);
source
Zarrs.LibZarrs.zarrs_jl_array_resize — Method
zarrs_jl_array_resize(storage, path, ndim, new_shape)

Resize an array.

Prototype

ZarrsResult zarrsJlArrayResize(StorageHandle *storage, const char *path, uintptr_t ndim, const uint64_t *new_shape);
source
Zarrs.LibZarrs.zarrs_jl_storage_get — Method
zarrs_jl_storage_get(storage, key)

Read a single key from storage, returning its bytes as a C string. Returns ZARRS_SUCCESS with null output if the key is not found.

Prototype

ZarrsResult zarrsJlStorageGet(StorageHandle *storage, const char *key, char **data_out);
source
Zarrs.LibZarrs.zarrs_jl_storage_list_dir — Method
zarrs_jl_storage_list_dir(storage, path)

List directory children, returning a JSON array of strings.

Prototype

ZarrsResult zarrsJlStorageListDir(StorageHandle *storage, const char *path, char **json_out);
source