Metalayers#

Metalayers are meta-information that can be attached to super-chunks. They can also be serialized to disk.

struct blosc2_metalayer#

This struct is meant to store metadata information inside a blosc2_schunk, allowing to specify, for example, how to interpret the contents included in the schunk.

Public Members

char *name#

The metalayer identifier for Blosc client (e.g. Caterva).

uint8_t *content#

The serialized (msgpack preferably) content of the metalayer.

int32_t content_len#

The length in bytes of the content.

Fixed-length metalayers#

int blosc2_meta_exists(blosc2_schunk *schunk, const char *name)#

Find whether the schunk has a metalayer or not.

Parameters:
  • schunk – The super-chunk from which the metalayer will be checked.

  • name – The name of the metalayer to be checked.

Returns:

If successful, return the index of the metalayer. Else, return a negative value.

int blosc2_meta_add(blosc2_schunk *schunk, const char *name, uint8_t *content, int32_t content_len)#

Add content into a new metalayer.

Parameters:
  • schunk – The super-chunk to which the metalayer should be added.

  • name – The name of the metalayer.

  • content – The content of the metalayer.

  • content_len – The length of the content.

Returns:

If successful, the index of the new metalayer. Else, return a negative value.

int blosc2_meta_update(blosc2_schunk *schunk, const char *name, uint8_t *content, int32_t content_len)#

Update the content of an existing metalayer.

Parameters:
  • schunk – The frame containing the metalayer.

  • name – The name of the metalayer to be updated.

  • content – The new content of the metalayer.

  • content_len – The length of the content.

Returns:

If successful, the index of the metalayer. Else, return a negative value.

Note

Contrarily to blosc2_meta_add the updates to metalayers are automatically serialized into a possible attached frame.

int blosc2_meta_get(blosc2_schunk *schunk, const char *name, uint8_t **content, int32_t *content_len)#

Get the content out of a metalayer.

Parameters:
  • schunk – The frame containing the metalayer.

  • name – The name of the metalayer.

  • content – The pointer where the content will be put.

  • content_len – The length of the content.

Returns:

If successful, the index of the new metalayer. Else, return a negative value.

Warning

The **content receives a malloc’ed copy of the content. The user is responsible of freeing it.

Variable-length metalayers#

int blosc2_vlmeta_exists(blosc2_schunk *schunk, const char *name)#

Find whether the schunk has a variable-length metalayer or not.

Parameters:
  • schunk – The super-chunk from which the variable-length metalayer will be checked.

  • name – The name of the variable-length metalayer to be checked.

Returns:

If successful, return the index of the variable-length metalayer. Else, return a negative value.

int blosc2_vlmeta_add(blosc2_schunk *schunk, const char *name, uint8_t *content, int32_t content_len, blosc2_cparams *cparams)#

Add content into a new variable-length metalayer.

Parameters:
  • schunk – The super-chunk to which the variable-length metalayer should be added.

  • name – The name of the variable-length metalayer.

  • content – The content to be added.

  • content_len – The length of the content.

  • cparams – The parameters for compressing the variable-length metalayer content. If NULL, the BLOSC2_CPARAMS_DEFAULTS will be used.

Returns:

If successful, the index of the new variable-length metalayer. Else, return a negative value.

int blosc2_vlmeta_update(blosc2_schunk *schunk, const char *name, uint8_t *content, int32_t content_len, blosc2_cparams *cparams)#

Update the content of an existing variable-length metalayer.

Parameters:
  • schunk – The super-chunk containing the variable-length metalayer.

  • name – The name of the variable-length metalayer to be updated.

  • content – The new content of the variable-length metalayer.

  • content_len – The length of the content.

  • cparams – The parameters for compressing the variable-length metalayer content. If NULL, the BLOSC2_CPARAMS_DEFAULTS will be used.

Returns:

If successful, the index of the variable-length metalayer. Else, return a negative value.

int blosc2_vlmeta_get(blosc2_schunk *schunk, const char *name, uint8_t **content, int32_t *content_len)#

Get the content out of a variable-length metalayer.

Parameters:
  • schunk – The super-chunk containing the variable-length metalayer.

  • name – The name of the variable-length metalayer.

  • content – The pointer where the content will be put.

  • content_len – The pointer where the length of the content will be put.

Returns:

If successful, the index of the new variable-length metalayer. Else, return a negative value.

Warning

The **content receives a malloc’ed copy of the content. The user is responsible of freeing it.