4 * Definitions for the builtin LZ compressor
6 * src/include/common/pg_lzcompress.h
10#ifndef _PG_LZCOMPRESS_H_
11#define _PG_LZCOMPRESS_H_
17 * Macro to compute the buffer size required by pglz_compress().
18 * We allow 4 bytes for overrun before detecting compression failure.
21 #define PGLZ_MAX_OUTPUT(_dlen) ((_dlen) + 4)
27 * Some values that control the compression algorithm.
29 * min_input_size Minimum input data size to consider compression.
31 * max_input_size Maximum input data size to consider compression.
33 * min_comp_rate Minimum compression rate (0-99%) to require.
34 * Regardless of min_comp_rate, the output must be
35 * smaller than the input, else we don't store
38 * first_success_by Abandon compression if we find no compressible
39 * data within the first this-many bytes.
41 * match_size_good The initial GOOD match size when starting history
42 * lookup. When looking up the history to find a
43 * match that could be expressed as a tag, the
44 * algorithm does not always walk back entirely.
45 * A good match fast is usually better than the
46 * best possible one very late. For each iteration
47 * in the lookup, this value is lowered so the
48 * longer the lookup takes, the smaller matches
49 * are considered good.
51 * match_size_drop The percentage by which match_size_good is lowered
52 * after each history check. Allowed values are
53 * 0 (no change until end) to 100 (only check
54 * latest history entry at all).
69 * The standard strategies
71 * PGLZ_strategy_default Recommended default strategy for TOAST.
73 * PGLZ_strategy_always Try to compress inputs of any length.
74 * Fallback to uncompressed storage only if
75 * output would be larger than input.
83 * Global function declarations
89 int32 rawsize,
bool check_complete);
91 int32 total_compressed_size);
93#endif /* _PG_LZCOMPRESS_H_ */
PGDLLIMPORT const PGLZ_Strategy *const PGLZ_strategy_always
PGDLLIMPORT const PGLZ_Strategy *const PGLZ_strategy_default
struct PGLZ_Strategy PGLZ_Strategy
int32 pglz_decompress(const char *source, int32 slen, char *dest, int32 rawsize, bool check_complete)
int32 pglz_compress(const char *source, int32 slen, char *dest, const PGLZ_Strategy *strategy)
int32 pglz_maximum_compressed_size(int32 rawsize, int32 total_compressed_size)
static rewind_source * source