Debian Codegraph @

lib/grn_compressor.h

raw symbols SCIP
1 /*
2 Copyright (C) 2009-2018 Brazil
3 Copyright (C) 2020-2025 Sutou Kouhei <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #pragma once
21
22 #include "grn_ctx.h"cxx . . $ `<file>/lib/grn_ctx.h`/
23
24 typedef enum grn_compression_typecxx . . $ grn_compression_type# {
25 GRN_COMPRESSION_TYPE_NONEcxx . . $ GRN_COMPRESSION_TYPE_NONE.,
26 GRN_COMPRESSION_TYPE_ZLIBcxx . . $ GRN_COMPRESSION_TYPE_ZLIB.,
27 GRN_COMPRESSION_TYPE_LZ4cxx . . $ GRN_COMPRESSION_TYPE_LZ4.,
28 GRN_COMPRESSION_TYPE_ZSTDcxx . . $ GRN_COMPRESSION_TYPE_ZSTD.,
29 GRN_COMPRESSION_TYPE_BLOSCcxx . . $ GRN_COMPRESSION_TYPE_BLOSC.,
30 GRN_COMPRESSION_TYPE_OPENZLcxx . . $ GRN_COMPRESSION_TYPE_OPENZL.,
31 } grn_compression_typecxx . . $ grn_compression_type#;
32
33 typedef struct grn_compress_datacxx . . $ grn_compress_data# {
34 /* Input: Start */
35 grn_compression_typecxx . . $ grn_compression_type# typecxx . . $ grn_compress_data#type.;
36 void *headercxx . . $ grn_compress_data#header.;
37 uint32_tcxx . . $ uint32_t# header_lencxx . . $ grn_compress_data#header_len.;
38 void *bodycxx . . $ grn_compress_data#body.;
39 uint32_tcxx . . $ uint32_t# body_lencxx . . $ grn_compress_data#body_len.;
40
41 /* Only for GRN_COMPRESSION_TYPE_BLOSC/OPENZL: Start */
42 size_t body_n_elementscxx . . $ grn_compress_data#body_n_elements.;
43 grn_column_flagscxx . . $ grn_column_flags# body_column_flagscxx . . $ grn_compress_data#body_column_flags.;
44 grn_idcxx . . $ grn_id# body_rangecxx . . $ grn_compress_data#body_range.;
45 /* Only for GRN_COMPRESSION_TYPE_BLOSC/OPENZL: End */
46
47 /* Only for GRN_COMPRESSION_TYPE_OPENZL: Start */
48 size_t body_element_sizecxx . . $ grn_compress_data#body_element_size.;
49 /* Only for GRN_COMPRESSION_TYPE_OPENZL: End */
50
51 void *footercxx . . $ grn_compress_data#footer.;
52 uint32_tcxx . . $ uint32_t# footer_lencxx . . $ grn_compress_data#footer_len.;
53 /* Input: End */
54
55 /* Output: Start */
56 void *packed_valuecxx . . $ grn_compress_data#packed_value.;
57 uint32_tcxx . . $ uint32_t# packed_value_lencxx . . $ grn_compress_data#packed_value_len.;
58 void *compressed_valuecxx . . $ grn_compress_data#compressed_value.;
59 uint32_tcxx . . $ uint32_t# compressed_value_lencxx . . $ grn_compress_data#compressed_value_len.;
60 /* Output: End */
61 } grn_compress_datacxx . . $ grn_compress_data#;
62
63 typedef struct grn_decompress_datacxx . . $ grn_decompress_data# {
64 /* Input */
65 grn_compression_typecxx . . $ grn_compression_type# typecxx . . $ grn_decompress_data#type.;
66 void *raw_valuecxx . . $ grn_decompress_data#raw_value.;
67 uint32_tcxx . . $ uint32_t# raw_value_lencxx . . $ grn_decompress_data#raw_value_len.;
68
69 /* Output */
70 void *unpacked_valuecxx . . $ grn_decompress_data#unpacked_value.;
71 uint32_tcxx . . $ uint32_t# unpacked_value_lencxx . . $ grn_decompress_data#unpacked_value_len.;
72 void *decompressed_valuecxx . . $ grn_decompress_data#decompressed_value.;
73 uint32_tcxx . . $ uint32_t# decompressed_value_lencxx . . $ grn_decompress_data#decompressed_value_len.;
74
75 /* Internal */
76 void *compressed_valuecxx . . $ grn_decompress_data#compressed_value.;
77 uint32_tcxx . . $ uint32_t# compressed_value_lencxx . . $ grn_decompress_data#compressed_value_len.;
78 } grn_decompress_datacxx . . $ grn_decompress_data#;
79
80 /*
81 * data->compression_type must not be GRN_COMPRESSION_TYPE_NONE.
82 *
83 * If GRN_SUCCESS isn't returned, you don't need to free anything.
84 *
85 * If GRN_SUCCESS is returned:
86 *
87 * * If data->packed_value_len > 0: You need to free
88 * data->packed_value by GRN_FREE().
89 * * Else: You need to free data->compressed_value by GRN_FREE().
90 */
91 grn_rccxx . . $ grn_rc#
92 grn_compressor_compresscxx . . $ grn_compressor_compress(38ea3b41608d581c).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_compress_datacxx . . $ grn_compress_data# *data);
93
94 /*
95 * data->compression_type must not be GRN_COMPRESSION_TYPE_NONE.
96 *
97 * If GRN_SUCCESS isn't returned, you don't need to free anything.
98 *
99 * If GRN_SUCCESS is returned:
100 * * If data->unpacked_value_len > 0: You don't need to free anything.
101 * * Else: You need to free data->decompressed_value by GRN_FREE().
102 */
103 grn_rccxx . . $ grn_rc#
104 grn_compressor_decompresscxx . . $ grn_compressor_decompress(a8f2aa4281176350).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_decompress_datacxx . . $ grn_decompress_data# *data);