diff options
Diffstat (limited to 'src/include/common/backup_compression.h')
-rw-r--r-- | src/include/common/backup_compression.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/include/common/backup_compression.h b/src/include/common/backup_compression.h new file mode 100644 index 00000000000..0565cbc657d --- /dev/null +++ b/src/include/common/backup_compression.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * backup_compression.h + * + * Shared definitions for backup compression methods and specifications. + * + * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/common/backup_compression.h + *------------------------------------------------------------------------- + */ + +#ifndef BACKUP_COMPRESSION_H +#define BACKUP_COMPRESSION_H + +typedef enum bc_algorithm +{ + BACKUP_COMPRESSION_NONE, + BACKUP_COMPRESSION_GZIP, + BACKUP_COMPRESSION_LZ4, + BACKUP_COMPRESSION_ZSTD +} bc_algorithm; + +#define BACKUP_COMPRESSION_OPTION_LEVEL (1 << 0) + +typedef struct bc_specification +{ + bc_algorithm algorithm; + unsigned options; /* OR of BACKUP_COMPRESSION_OPTION constants */ + int level; + char *parse_error; /* NULL if parsing was OK, else message */ +} bc_specification; + +extern bool parse_bc_algorithm(char *name, bc_algorithm *algorithm); +extern const char *get_bc_algorithm_name(bc_algorithm algorithm); + +extern void parse_bc_specification(bc_algorithm algorithm, + char *specification, + bc_specification *result); + +extern char *validate_bc_specification(bc_specification *); + +#endif |