Metalayers#

Metalayers are metadata for informing about the properties of data that is stored on a container. Caterva implements its own metalayer on top of C-Blosc2 for storing multidimensional information. In general, you can use metalayers for adapting Blosc2 containers (and in particular, Caterva arrays) to your own needs.

Fixed-length metalayers#

These small metalayers are stored in the header of the frame. This allows adding chunks to the frame without the need to rewrite the whole meta information and data coming after it. However, fixed-length metalayers cannot be resized and once the first chunk of data is added to the super-chunk, no more fixed-length metalayers can be added either.

int caterva_meta_exists(caterva_ctx_t *ctx, caterva_array_t *array, const char *name, bool *exists)#

Check if a metalayer exists or not.

Parameters
  • ctx – The context to be used.

  • array – The array where the check will be done.

  • name – The name of the metalayer to check.

  • exists – Pointer where the result will be stored.

Returns

An error code

int caterva_meta_get(caterva_ctx_t *ctx, caterva_array_t *array, const char *name, caterva_metalayer_t *meta)#

Get a metalayer from a Caterva array.

Warning

The contents of meta are allocated inside the function. Therefore, they must be released with a free.

Parameters
  • ctx – The context to be used.

  • array – The array where the metalayer will be added.

  • name – The vl-metalayer name.

  • meta – Pointer to the metalayer where the data will be stored.

Returns

An error code

int caterva_meta_update(caterva_ctx_t *ctx, caterva_array_t *array, caterva_metalayer_t *meta)#

Update a metalayer content in a Caterva array.

Parameters
  • ctx – The context to be used.

  • array – The array where the metalayer will be updated.

  • meta – The metalayer to update.

Returns

An error code

Variable-length metalayers#

Unlike fixed-length metalayers, these can be resized and are stored in the trailer section of the frame. This provides users a lot of flexibility to define their own metadata.

int caterva_vlmeta_add(caterva_ctx_t *ctx, caterva_array_t *array, caterva_metalayer_t *vlmeta)#

Add a vl-metalayer to the Caterva array.

Parameters
  • ctx – The context to be used.

  • array – The array where the metalayer will be added.

  • name – The vl-metalayer to add.

Returns

An error code

int caterva_vlmeta_exists(caterva_ctx_t *ctx, caterva_array_t *array, const char *name, bool *exists)#

Check if a vl-metalayer exists or not.

Parameters
  • ctx – The context to be used.

  • array – The array where the check will be done.

  • name – The name of the vl-metalayer to check.

  • exists – Pointer where the result will be stored.

Returns

An error code

int caterva_vlmeta_get(caterva_ctx_t *ctx, caterva_array_t *array, const char *name, caterva_metalayer_t *vlmeta)#

Get a vl-metalayer from a Caterva array.

Warning

The contents of vlmeta are allocated inside the function. Therefore, they must be released with a free.

Parameters
  • ctx – The context to be used.

  • array – The array where the vl-metalayer will be added.

  • name – The vl-metalayer name.

  • vlmeta – Pointer to the metalayer where the data will be stored.

Returns

An error code

int caterva_vlmeta_update(caterva_ctx_t *ctx, caterva_array_t *array, caterva_metalayer_t *vlmeta)#

Update a vl-metalayer content in a Caterva array.

Parameters
  • ctx – The context to be used.

  • array – The array where the vl-metalayer will be updated.

  • vlmeta – The vl-metalayer to update.

Returns

An error code