|
zarrs_ffi
C/C++ bindings for the zarrs rust crate
|
#include <stdarg.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <stdlib.h>#include <assert.h>
Go to the source code of this file.
Macros | |
| #define | zarrs_assert(expr) assert(ZARRS_SUCCESS == expr) |
Typedefs | |
| typedef int32_t | ZarrsResult |
| typedef int32_t | ZarrsDataType |
| typedef struct ZarrsArray_T | ZarrsArray_T |
| typedef struct ZarrsGroup_T | ZarrsGroup_T |
| typedef struct ZarrsShardIndexCache_T | ZarrsShardIndexCache_T |
| typedef struct ZarrsStorage_T | ZarrsStorage_T |
| typedef struct ZarrsArray_T * | ZarrsArray |
| typedef struct ZarrsShardIndexCache_T * | ZarrsShardIndexCache |
| typedef struct ZarrsStorage_T * | ZarrsStorage |
| typedef struct ZarrsGroup_T * | ZarrsGroup |
Enumerations | |
| enum | ZarrsResult { ZARRS_SUCCESS = 0 , ZARRS_ERROR_NULL_PTR = -1 , ZARRS_ERROR_STORAGE = -2 , ZARRS_ERROR_ARRAY = -3 , ZARRS_ERROR_BUFFER_LENGTH = -4 , ZARRS_ERROR_INVALID_INDICES = -5 , ZARRS_ERROR_NODE_PATH = -6 , ZARRS_ERROR_STORE_PREFIX = -7 , ZARRS_ERROR_INVALID_METADATA = -8 , ZARRS_ERROR_STORAGE_CAPABILITY = -9 , ZARRS_ERROR_UNKNOWN_CHUNK_GRID_SHAPE = -10 , ZARRS_ERROR_UNKNOWN_INTERSECTING_CHUNKS = -11 , ZARRS_ERROR_UNSUPPORTED_DATA_TYPE = -12 , ZARRS_ERROR_GROUP = -13 , ZARRS_ERROR_INCOMPATIBLE_DIMENSIONALITY = -14 } |
| enum | ZarrsDataType { ZARRS_UNDEFINED = -1 , ZARRS_BOOL = 0 , ZARRS_INT8 = 1 , ZARRS_INT16 = 2 , ZARRS_INT32 = 3 , ZARRS_INT64 = 4 , ZARRS_UINT8 = 5 , ZARRS_UINT16 = 6 , ZARRS_UINT32 = 7 , ZARRS_UINT64 = 8 , ZARRS_FLOAT16 = 9 , ZARRS_FLOAT32 = 10 , ZARRS_FLOAT64 = 11 , ZARRS_COMPLEX64 = 12 , ZARRS_COMPLEX128 = 13 , ZARRS_RAW_BITS = 14 , ZARRS_BFLOAT16 = 15 } |
Functions | |
| ZarrsResult | zarrsArrayGetAttributes (ZarrsArray array, bool pretty, char **pAttributesString) |
| ZarrsResult | zarrsArrayGetAttributesString (ZarrsArray array, bool pretty, char **pAttributesString) |
| ZarrsResult | zarrsArrayGetChunkGridShape (ZarrsArray array, size_t dimensionality, uint64_t *pChunkGridShape) |
| ZarrsResult | zarrsArrayGetChunkOrigin (ZarrsArray array, size_t dimensionality, const uint64_t *pChunkIndices, uint64_t *pChunkOrigin) |
| ZarrsResult | zarrsArrayGetChunkShape (ZarrsArray array, size_t dimensionality, const uint64_t *pChunkIndices, uint64_t *pChunkShape) |
| ZarrsResult | zarrsArrayGetChunkSize (ZarrsArray array, size_t dimensionality, const uint64_t *pChunkIndices, size_t *chunkSize) |
| ZarrsResult | zarrsArrayGetChunksInSubset (ZarrsArray array, size_t dimensionality, const uint64_t *pSubsetStart, const uint64_t *pSubsetShape, uint64_t *pChunksStart, uint64_t *pChunksShape) |
| ZarrsResult | zarrsArrayGetDataType (ZarrsArray array, ZarrsDataType *pDataType) |
| ZarrsResult | zarrsArrayGetDimensionality (ZarrsArray array, size_t *dimensionality) |
| ZarrsResult | zarrsArrayGetInnerChunkGridShape (ZarrsArray array, size_t dimensionality, uint64_t *pInnerChunkGridShape) |
| ZarrsResult | zarrsArrayGetInnerChunkShape (ZarrsArray array, size_t dimensionality, bool *pIsSharded, uint64_t *pInnerChunkShape) |
| ZarrsResult | zarrsArrayGetMetadataString (ZarrsArray array, bool pretty, char **pMetadataString) |
| ZarrsResult | zarrsArrayGetShape (ZarrsArray array, size_t dimensionality, uint64_t *pShape) |
| ZarrsResult | zarrsArrayGetSubsetSize (ZarrsArray array, size_t dimensionality, const uint64_t *pSubsetShape, size_t *subsetSize) |
| ZarrsResult | zarrsArrayRetrieveChunk (ZarrsArray array, size_t dimensionality, const uint64_t *pChunkIndices, size_t chunkBytesCount, uint8_t *pChunkBytes) |
| ZarrsResult | zarrsArrayRetrieveInnerChunk (ZarrsArray array, ZarrsShardIndexCache cache, size_t dimensionality, const uint64_t *pChunkIndices, size_t chunkBytesCount, uint8_t *pChunkBytes) |
| ZarrsResult | zarrsArrayRetrieveSubset (ZarrsArray array, size_t dimensionality, const uint64_t *pSubsetStart, const uint64_t *pSubsetShape, size_t subsetBytesCount, uint8_t *pSubsetBytes) |
| ZarrsResult | zarrsArrayRetrieveSubsetSharded (ZarrsArray array, ZarrsShardIndexCache cache, size_t dimensionality, const uint64_t *pSubsetStart, const uint64_t *pSubsetShape, size_t subsetBytesCount, uint8_t *pSubsetBytes) |
| ZarrsResult | zarrsArraySetAttributes (ZarrsArray array, const char *attributes) |
| ZarrsResult | zarrsArrayStoreChunk (ZarrsArray array, size_t dimensionality, const uint64_t *pChunkIndices, size_t chunkBytesCount, const uint8_t *pChunkBytes) |
| ZarrsResult | zarrsArrayStoreMetadata (ZarrsArray array) |
| ZarrsResult | zarrsArrayStoreSubset (ZarrsArray array, size_t dimensionality, const uint64_t *pSubsetStart, const uint64_t *pSubsetShape, size_t subsetBytesCount, const uint8_t *pSubsetBytes) |
| ZarrsResult | zarrsCreateArrayRW (ZarrsStorage storage, const char *path, const char *metadata, ZarrsArray *pArray) |
| ZarrsResult | zarrsCreateGroupRW (ZarrsStorage storage, const char *path, const char *metadata, ZarrsGroup *pGroup) |
| ZarrsResult | zarrsCreateShardIndexCache (ZarrsArray array, ZarrsShardIndexCache *pShardIndexCache) |
| ZarrsResult | zarrsCreateStorageFilesystem (const char *path, ZarrsStorage *pStorage) |
| ZarrsResult | zarrsDestroyArray (ZarrsArray array) |
| ZarrsResult | zarrsDestroyGroup (ZarrsGroup group) |
| ZarrsResult | zarrsDestroyShardIndexCache (ZarrsShardIndexCache shardIndexCache) |
| ZarrsResult | zarrsDestroyStorage (ZarrsStorage storage) |
| ZarrsResult | zarrsFreeString (char *string) |
| ZarrsResult | zarrsGroupGetAttributes (ZarrsGroup group, bool pretty, char **pAttributesString) |
| ZarrsResult | zarrsGroupSetAttributes (ZarrsGroup group, const char *attributes) |
| ZarrsResult | zarrsGroupStoreMetadata (ZarrsGroup group) |
| char * | zarrsLastError (void) |
| ZarrsResult | zarrsOpenArrayRW (ZarrsStorage storage, const char *path, ZarrsArray *pArray) |
| ZarrsResult | zarrsOpenGroupRW (ZarrsStorage storage, const char *path, ZarrsGroup *pGroup) |
| uint32_t | zarrsVersion (void) |
| uint32_t | zarrsVersionMajor (void) |
| uint32_t | zarrsVersionMinor (void) |
| uint32_t | zarrsVersionPatch (void) |
| #define zarrs_assert | ( | expr | ) | assert(ZARRS_SUCCESS == expr) |
| typedef struct ZarrsArray_T* ZarrsArray |
| typedef struct ZarrsArray_T ZarrsArray_T |
| typedef int32_t ZarrsDataType |
| typedef struct ZarrsGroup_T* ZarrsGroup |
| typedef struct ZarrsGroup_T ZarrsGroup_T |
| typedef int32_t ZarrsResult |
| typedef struct ZarrsShardIndexCache_T* ZarrsShardIndexCache |
| typedef struct ZarrsShardIndexCache_T ZarrsShardIndexCache_T |
| typedef struct ZarrsStorage_T* ZarrsStorage |
| typedef struct ZarrsStorage_T ZarrsStorage_T |
| enum ZarrsDataType |
| enum ZarrsResult |
| ZarrsResult zarrsArrayGetAttributes | ( | ZarrsArray | array, |
| bool | pretty, | ||
| char ** | pAttributesString | ||
| ) |
| ZarrsResult zarrsArrayGetAttributesString | ( | ZarrsArray | array, |
| bool | pretty, | ||
| char ** | pAttributesString | ||
| ) |
| ZarrsResult zarrsArrayGetChunkGridShape | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| uint64_t * | pChunkGridShape | ||
| ) |
Return the number of chunks in the chunk grid.
ZarrsResult::ZARRS_ERROR_NULL_PTR if array is a null pointer.ZarrsResult::ZARRS_ERROR_INCOMPATIBLE_DIMENSIONALITY if dimensionality does not match the array dimensionality.If not null, array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the array pointed to by pChunkGridShape.
| ZarrsResult zarrsArrayGetChunkOrigin | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pChunkIndices, | ||
| uint64_t * | pChunkOrigin | ||
| ) |
| ZarrsResult zarrsArrayGetChunkShape | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pChunkIndices, | ||
| uint64_t * | pChunkShape | ||
| ) |
| ZarrsResult zarrsArrayGetChunksInSubset | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pSubsetStart, | ||
| const uint64_t * | pSubsetShape, | ||
| uint64_t * | pChunksStart, | ||
| uint64_t * | pChunksShape | ||
| ) |
Return the chunks indicating the chunks intersecting array_subset.
ZarrsResult::ZARRS_ERROR_NULL_PTR if array is a null pointer.ZarrsResult::ZARRS_ERROR_INCOMPATIBLE_DIMENSIONALITY if dimensionality does not match the array dimensionality.ZarrsResult::ZARRS_ERROR_UNKNOWN_INTERSECTING_CHUNKS if the intersecting chunks cannot be determined.If not null, array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the arrays pointed to by pSubsetStart, pSubsetShape, pChunksStart, and pChunksShape.
| ZarrsResult zarrsArrayGetChunkSize | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pChunkIndices, | ||
| size_t * | chunkSize | ||
| ) |
| ZarrsResult zarrsArrayGetDataType | ( | ZarrsArray | array, |
| ZarrsDataType * | pDataType | ||
| ) |
| ZarrsResult zarrsArrayGetDimensionality | ( | ZarrsArray | array, |
| size_t * | dimensionality | ||
| ) |
| ZarrsResult zarrsArrayGetInnerChunkGridShape | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| uint64_t * | pInnerChunkGridShape | ||
| ) |
Get the shape of the inner chunk grid of a sharded array.
If the array is not sharded, the contents of pInnerChunkGridShape will equal the standard chunk grid shape.
ZarrsResult::ZARRS_ERROR_NULL_PTR if array is a null pointer.ZarrsResult::ZARRS_ERROR_INCOMPATIBLE_DIMENSIONALITY if dimensionality does not match the array dimensionality.array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the array pointed to by pInnerChunkGridShape.
| ZarrsResult zarrsArrayGetInnerChunkShape | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| bool * | pIsSharded, | ||
| uint64_t * | pInnerChunkShape | ||
| ) |
Get the inner chunk shape for a sharded array.
pIsSharded is set to true if the array is sharded, otherwise false. If the array is not sharded, the contents of pInnerChunkShape will be undefined.
array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the array pointed to by pChunkShape.
| ZarrsResult zarrsArrayGetMetadataString | ( | ZarrsArray | array, |
| bool | pretty, | ||
| char ** | pMetadataString | ||
| ) |
| ZarrsResult zarrsArrayGetShape | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| uint64_t * | pShape | ||
| ) |
Returns the shape of the array.
ZarrsResult::ZARRS_ERROR_NULL_PTR if array is a null pointer.ZarrsResult::ZARRS_ERROR_INCOMPATIBLE_DIMENSIONALITY if dimensionality does not match the array dimensionality.If not null, array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the array pointed to by pShape.
| ZarrsResult zarrsArrayGetSubsetSize | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pSubsetShape, | ||
| size_t * | subsetSize | ||
| ) |
| ZarrsResult zarrsArrayRetrieveChunk | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pChunkIndices, | ||
| size_t | chunkBytesCount, | ||
| uint8_t * | pChunkBytes | ||
| ) |
Retrieve a chunk from an array.
pChunkIndices is a pointer to an array of length dimensionality holding the chunk indices. pChunkBytes is a pointer to an array of bytes of length chunkBytesCount that must match the expected size of the chunk as returned by zarrsArrayGetChunkSize().
Returns an error if the array does not have read capability.
array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the array pointed to by pChunkIndices.
| ZarrsResult zarrsArrayRetrieveInnerChunk | ( | ZarrsArray | array, |
| ZarrsShardIndexCache | cache, | ||
| size_t | dimensionality, | ||
| const uint64_t * | pChunkIndices, | ||
| size_t | chunkBytesCount, | ||
| uint8_t * | pChunkBytes | ||
| ) |
Retrieve an inner chunk from a sharded array (or outer chunk for an unsharded array).
pChunkIndices is a pointer to an array of length dimensionality holding the chunk indices. pChunkBytes is a pointer to an array of bytes of length chunkBytesCount that must match the expected size of the chunk as returned by zarrsArrayGetChunkSize().
Returns an error if the array does not have read capability.
array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the array pointed to by pChunkIndices.
| ZarrsResult zarrsArrayRetrieveSubset | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pSubsetStart, | ||
| const uint64_t * | pSubsetShape, | ||
| size_t | subsetBytesCount, | ||
| uint8_t * | pSubsetBytes | ||
| ) |
Retrieve a subset from an array.
pSubsetStart and pSubsetShape are pointers to arrays of length dimensionality holding the chunk start and shape respectively. pSubsetBytes is a pointer to an array of bytes of length subsetBytesCount that must match the expected size of the subset as returned by zarrsArrayGetSubsetSize().
Returns an error if the array does not have read capability.
array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the arrays pointed to by pSubsetStart and pSubsetShape.
| ZarrsResult zarrsArrayRetrieveSubsetSharded | ( | ZarrsArray | array, |
| ZarrsShardIndexCache | cache, | ||
| size_t | dimensionality, | ||
| const uint64_t * | pSubsetStart, | ||
| const uint64_t * | pSubsetShape, | ||
| size_t | subsetBytesCount, | ||
| uint8_t * | pSubsetBytes | ||
| ) |
Retrieve a subset from an array (with a shard index cache).
pSubsetStart and pSubsetShape are pointers to arrays of length dimensionality holding the chunk start and shape respectively. pSubsetBytes is a pointer to an array of bytes of length subsetBytesCount that must match the expected size of the subset as returned by zarrsArrayGetSubsetSize().
Returns an error if the array does not have read capability.
array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the arrays pointed to by pSubsetStart and pSubsetShape.
| ZarrsResult zarrsArraySetAttributes | ( | ZarrsArray | array, |
| const char * | attributes | ||
| ) |
| ZarrsResult zarrsArrayStoreChunk | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pChunkIndices, | ||
| size_t | chunkBytesCount, | ||
| const uint8_t * | pChunkBytes | ||
| ) |
Store a chunk.
pChunkIndices is a pointer to an array of length dimensionality holding the chunk indices. pChunkBytes is a pointer to an array of bytes of length chunkBytesCount that must match the expected size of the chunk as returned by zarrsArrayGetChunkSize().
Returns an error if the array does not have write capability.
array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the array pointed to by pChunkIndices.
| ZarrsResult zarrsArrayStoreMetadata | ( | ZarrsArray | array | ) |
| ZarrsResult zarrsArrayStoreSubset | ( | ZarrsArray | array, |
| size_t | dimensionality, | ||
| const uint64_t * | pSubsetStart, | ||
| const uint64_t * | pSubsetShape, | ||
| size_t | subsetBytesCount, | ||
| const uint8_t * | pSubsetBytes | ||
| ) |
Store an array subset.
pSubsetStart and pSubsetShape are pointers to arrays of length dimensionality holding the chunk start and shape respectively. pSubsetBytes is a pointer to an array of bytes of length subsetBytesCount that must match the expected size of the subset as returned by zarrsArrayGetSubsetSize().
Returns an error if the array does not have read/write capability.
array must be a valid ZarrsArray handle. dimensionality must match the dimensionality of the array and the length of the arrays pointed to by pSubsetStart and pSubsetShape.
| ZarrsResult zarrsCreateArrayRW | ( | ZarrsStorage | storage, |
| const char * | path, | ||
| const char * | metadata, | ||
| ZarrsArray * | pArray | ||
| ) |
| ZarrsResult zarrsCreateGroupRW | ( | ZarrsStorage | storage, |
| const char * | path, | ||
| const char * | metadata, | ||
| ZarrsGroup * | pGroup | ||
| ) |
| ZarrsResult zarrsCreateShardIndexCache | ( | ZarrsArray | array, |
| ZarrsShardIndexCache * | pShardIndexCache | ||
| ) |
| ZarrsResult zarrsCreateStorageFilesystem | ( | const char * | path, |
| ZarrsStorage * | pStorage | ||
| ) |
| ZarrsResult zarrsDestroyArray | ( | ZarrsArray | array | ) |
| ZarrsResult zarrsDestroyGroup | ( | ZarrsGroup | group | ) |
| ZarrsResult zarrsDestroyShardIndexCache | ( | ZarrsShardIndexCache | shardIndexCache | ) |
| ZarrsResult zarrsDestroyStorage | ( | ZarrsStorage | storage | ) |
| ZarrsResult zarrsFreeString | ( | char * | string | ) |
| ZarrsResult zarrsGroupGetAttributes | ( | ZarrsGroup | group, |
| bool | pretty, | ||
| char ** | pAttributesString | ||
| ) |
| ZarrsResult zarrsGroupSetAttributes | ( | ZarrsGroup | group, |
| const char * | attributes | ||
| ) |
| ZarrsResult zarrsGroupStoreMetadata | ( | ZarrsGroup | group | ) |
| char * zarrsLastError | ( | void | ) |
Get the last error string.
The string must be freed with zarrsFreeString.
| ZarrsResult zarrsOpenArrayRW | ( | ZarrsStorage | storage, |
| const char * | path, | ||
| ZarrsArray * | pArray | ||
| ) |
| ZarrsResult zarrsOpenGroupRW | ( | ZarrsStorage | storage, |
| const char * | path, | ||
| ZarrsGroup * | pGroup | ||
| ) |
| uint32_t zarrsVersion | ( | void | ) |
Get the zarrs version.
A u32 representation of the version encoded as (zarrsVersionMajor() << 22) | (zarrsVersionMinor() << 12) | zarrsVersionPatch().
| uint32_t zarrsVersionMajor | ( | void | ) |
Get the zarrs major version.
| uint32_t zarrsVersionMinor | ( | void | ) |
Get the zarrs minor version.
| uint32_t zarrsVersionPatch | ( | void | ) |
Get the zarrs patch version.