compression.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*-------------------------------------------------------------------------
  2. *
  3. * compression.h
  4. *
  5. * Shared definitions for compression methods and specifications.
  6. *
  7. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  8. *
  9. * IDENTIFICATION
  10. * src/common/compression.h
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef PG_COMPRESSION_H
  14. #define PG_COMPRESSION_H
  15. typedef enum pg_compress_algorithm
  16. {
  17. PG_COMPRESSION_NONE,
  18. PG_COMPRESSION_GZIP,
  19. PG_COMPRESSION_LZ4,
  20. PG_COMPRESSION_ZSTD
  21. } pg_compress_algorithm;
  22. #define PG_COMPRESSION_OPTION_WORKERS (1 << 0)
  23. typedef struct pg_compress_specification
  24. {
  25. pg_compress_algorithm algorithm;
  26. unsigned options; /* OR of PG_COMPRESSION_OPTION constants */
  27. int level;
  28. int workers;
  29. char *parse_error; /* NULL if parsing was OK, else message */
  30. } pg_compress_specification;
  31. extern bool parse_compress_algorithm(char *name, pg_compress_algorithm *algorithm);
  32. extern const char *get_compress_algorithm_name(pg_compress_algorithm algorithm);
  33. extern void parse_compress_specification(pg_compress_algorithm algorithm,
  34. char *specification,
  35. pg_compress_specification *result);
  36. extern char *validate_compress_specification(pg_compress_specification *);
  37. #endif