Skip to main content
`Ctrl`+`K`

# Plugins

## Filters

typedef int (*blosc2_filter_forward_cb)(const uint8_t*, uint8_t*, int32_t, uint8_t, blosc2_cparams*, uint8_t)

typedef int (*blosc2_filter_backward_cb)(const uint8_t*, uint8_t*, int32_t, uint8_t, blosc2_dparams*, uint8_t)

struct blosc2_filter

  The parameters for a user-defined filter.

  Public Members

  uint8_t id

    The filter identifier.

  char *name

    The filter name.

  uint8_t version

    The filter version.

  blosc2_filter_forward_cb forward

    The filter function that is used during compression.

  blosc2_filter_backward_cb backward

    The filter function that is used during decompression.

int blosc2_register_filter(blosc2_filter *filter)

  Register locally a user-defined filter in Blosc.

  Parameters:

    - filter – The filter to register.

  Returns:

    0 if succeeds. Else a negative code is returned.

## Codecs

typedef int (*blosc2_codec_encoder_cb)(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, uint8_t meta, blosc2_cparams *cparams, const void *chunk)

typedef int (*blosc2_codec_decoder_cb)(const uint8_t *input, int32_t input_len, uint8_t *output, int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk)

struct blosc2_codec

  Public Members

  uint8_t compcode

    The codec identifier.

  char *compname

    The codec name.

  uint8_t complib

    The codec library format.

  uint8_t version

    The codec version.

  blosc2_codec_encoder_cb encoder

    The codec encoder that is used during compression.

  blosc2_codec_decoder_cb decoder

    The codec decoder that is used during decompression.

int blosc2_register_codec(blosc2_codec *codec)

  Register locally a user-defined codec in Blosc.

  Parameters:

    - codec – The codec to register.

  Returns:

    0 if succeeds. Else a negative code is returned.

## Tuners

struct blosc2_tuner

  Public Members

  int (*init)(void *config, blosc2_context *cctx, blosc2_context *dctx)

    Initialize tuner. Keep in mind dctx may be NULL. This should memcpy the cctx->tuner_params.

  int (*next_blocksize)(blosc2_context *context)

    Only compute the next blocksize. Only it is executed if tuner is not initialized.

  int (*next_cparams)(blosc2_context *context)

    Compute the next cparams. Only is executed if tuner is initialized.

  int (*update)(blosc2_context *context, double ctime)

    Update the tuner parameters.

  int (*free)(blosc2_context *context)

    Free the tuner.

  int id

    The tuner id.

  char *name

    The tuner name.

int blosc2_register_tuner(blosc2_tuner *tuner)

  Register locally a user-defined tuner in Blosc.

  Parameters:

    - tuner – The tuner to register.

  Returns:

    0 if succeeds. Else a negative code is returned.

## IO backends

typedef void *(*blosc2_open_cb)(const char *urlpath, const char *mode, void *params)

typedef int (*blosc2_close_cb)(void *stream)

typedef int64_t (*blosc2_write_cb)(const void *ptr, int64_t size, int64_t nitems, int64_t position, void *stream)

typedef int64_t (*blosc2_read_cb)(void **ptr, int64_t size, int64_t nitems, int64_t position, void *stream)

typedef int (*blosc2_truncate_cb)(void *stream, int64_t size)

struct blosc2_io_cb

  Public Members

  uint8_t id

    The IO identifier.

  char *name

    The IO name.

  bool is_allocation_necessary

    If true, the caller needs to allocate data for the read function (ptr argument). If false, the read function takes care of memory allocation and stores the address in the allocated_ptr argument.

  blosc2_open_cb open

    The IO open callback.

  blosc2_close_cb close

    The IO close callback.

  blosc2_size_cb size

    The IO size callback.

  blosc2_write_cb write

    The IO write callback.

  blosc2_read_cb read

    The IO read callback.

  blosc2_truncate_cb truncate

    The IO truncate callback.

  blosc2_destroy_cb destroy

    The IO destroy callback (called in the end when finished with the schunk).

struct blosc2_io

  Public Members

  const char *name

    The IO identifier.

  void *params

    The IO parameters.

int blosc2_register_io_cb(const blosc2_io_cb *io)

  Register a user-defined input/output callbacks in Blosc.

  Parameters:

    - io – The callbacks API to register.

  Returns:

    0 if succeeds. Else a negative code is returned.

blosc2_io_cb *blosc2_get_io_cb(uint8_t id)

  Get a user-defined input/output callback in Blosc.

  Parameters:

    - id – The id of the callback to get.

  Returns:

    A pointer containing the desired callback if success. Else a NULL pointer is returned.