codekingpro/portable-devtools
116k
1/*-------------------------------------------------------------------------2 *3 * compression.h4 *5 * Shared definitions for compression methods and specifications.6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 *9 * IDENTIFICATION10 * src/include/common/compression.h11 *-------------------------------------------------------------------------12 */13 14#ifndef PG_COMPRESSION_H15#define PG_COMPRESSION_H16 17/*18 * These values are stored in disk, for example in files generated by pg_dump.19 * Create the necessary backwards compatibility layers if their order changes.20 */21typedef enum pg_compress_algorithm22{23 PG_COMPRESSION_NONE,24 PG_COMPRESSION_GZIP,25 PG_COMPRESSION_LZ4,26 PG_COMPRESSION_ZSTD27} pg_compress_algorithm;28 29#define PG_COMPRESSION_OPTION_WORKERS (1 << 0)30#define PG_COMPRESSION_OPTION_LONG_DISTANCE (1 << 1)31 32typedef struct pg_compress_specification33{34 pg_compress_algorithm algorithm;35 unsigned options; /* OR of PG_COMPRESSION_OPTION constants */36 int level;37 int workers;38 bool long_distance;39 char *parse_error; /* NULL if parsing was OK, else message */40} pg_compress_specification;41 42extern void parse_compress_options(const char *option, char **algorithm,43 char **detail);44extern bool parse_compress_algorithm(char *name, pg_compress_algorithm *algorithm);45extern const char *get_compress_algorithm_name(pg_compress_algorithm algorithm);46 47extern void parse_compress_specification(pg_compress_algorithm algorithm,48 char *specification,49 pg_compress_specification *result);50 51extern char *validate_compress_specification(pg_compress_specification *);52 53#endif54 