Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compcode to blosc_cbuffer_versions #44

Closed
FrancescAlted opened this issue Feb 2, 2014 · 4 comments
Closed

Add compcode to blosc_cbuffer_versions #44

FrancescAlted opened this issue Feb 2, 2014 · 4 comments

Comments

@FrancescAlted
Copy link
Member

It would be interesting to add a way to know which compressor was used to compress a buffer. The clear candidate for this is blosc_cbuffer_versions whose current signature is:

void blosc_cbuffer_versions(const void *cbuffer, int *version, int *versionlz);

and with the suggested change, the signature would become:

void blosc_cbuffer_versions(const void *cbuffer, int *version, int *compcode, int *versionlz);

which introduces an API change. However, as blosc_cbuffer_versions() should not be widely used, I think this is a reasonable change (although it may require a jump in the minor version).

Opinions?

@esc
Copy link
Member

esc commented Feb 2, 2014

I think this is a reasonable choice. Need to make sure though, that the version, versionlz, and compcode are clearly documented. Those variables are quite similar so we should seek to avoid confusion.

  • version is the format version of the Blosc metaccodec itself
  • compcode is the code for the real/internal/implementation codec library ( NOT the codec implementation, but see fix codec enumeration (in README) #45) used.
  • versionlz is the format version of the real/internal/implementation codec used.

Not sure yet about the correct terminology to use to describe the real/internal/implementation codec.

@FrancescAlted
Copy link
Member Author

Hmm, after putting some serious thought on this, I am leaning now to add a new API call:

int blosc_cbuffer_compcode(const void *cbuffer);

Where it returns the compressor code for the buffer. That avoids the API change, and although it makes the API a bit larger, I think it is nice to be explicit. Also, when in the future several filters would be allowed, a new API call could be added too:

int blosc_cbuffer_filtercode(const void *cbuffer);

What do you think?

Also, I agree that current variables in blosc_cbuffer_versions() must be better documented.

@esc
Copy link
Member

esc commented Feb 2, 2014

I think it would fit nicely with the function for setting the complib, some good symetry. Also, the cost of avoiding the API change in this case is not very large so it is preferable.

@FrancescAlted
Copy link
Member Author

Fixed in rev 365f819. I finally decided to go with a blosc_cbuffer_complib() because the most you can do is guessing the compression library, and not the actual compressor used. This only actually applies to LZ4, where both lz4 and lz4hc compressors map to the LZ4 library, but in the future there could be similar cases for other libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants