mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 00:03:09 -04:00
Switch pg_dump to use the Compression API, implemented by bf9aa490db. The CompressFileHandle replaces the cfp* family of functions with a struct of callbacks for accessing (compressed) files. This allows adding new compression methods simply by introducing a new struct instance with appropriate implementation of the callbacks. Archives compressed using custom compression methods store an identifier of the compression algorithm in their header instead of the compression level. The header version is bumped. Author: Georgios Kokolatos Reviewed-by: Michael Paquier, Rachel Heaton, Justin Pryzby, Tomas Vondra Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss%3D%40protonmail.com
52 lines
1.5 KiB
C
52 lines
1.5 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* compression.h
|
|
*
|
|
* Shared definitions for compression methods and specifications.
|
|
*
|
|
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
*
|
|
* IDENTIFICATION
|
|
* src/include/common/compression.h
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef PG_COMPRESSION_H
|
|
#define PG_COMPRESSION_H
|
|
|
|
/*
|
|
* These values are stored in disk, for example in files generated by pg_dump.
|
|
* Create the necessary backwards compatibility layers if their order changes.
|
|
*/
|
|
typedef enum pg_compress_algorithm
|
|
{
|
|
PG_COMPRESSION_NONE,
|
|
PG_COMPRESSION_GZIP,
|
|
PG_COMPRESSION_LZ4,
|
|
PG_COMPRESSION_ZSTD
|
|
} pg_compress_algorithm;
|
|
|
|
#define PG_COMPRESSION_OPTION_WORKERS (1 << 0)
|
|
|
|
typedef struct pg_compress_specification
|
|
{
|
|
pg_compress_algorithm algorithm;
|
|
unsigned options; /* OR of PG_COMPRESSION_OPTION constants */
|
|
int level;
|
|
int workers;
|
|
char *parse_error; /* NULL if parsing was OK, else message */
|
|
} pg_compress_specification;
|
|
|
|
extern void parse_compress_options(const char *option, char **algorithm,
|
|
char **detail);
|
|
extern bool parse_compress_algorithm(char *name, pg_compress_algorithm *algorithm);
|
|
extern const char *get_compress_algorithm_name(pg_compress_algorithm algorithm);
|
|
|
|
extern void parse_compress_specification(pg_compress_algorithm algorithm,
|
|
char *specification,
|
|
pg_compress_specification *result);
|
|
|
|
extern char *validate_compress_specification(pg_compress_specification *);
|
|
|
|
#endif
|