PostgreSQL Source Code  git master
basebackup_gzip.c File Reference
#include "postgres.h"
#include "backup/basebackup_sink.h"
Include dependency graph for basebackup_gzip.c:

Go to the source code of this file.

Functions

bbsinkbbsink_gzip_new (bbsink *next, pg_compress_specification *compress)
 

Function Documentation

◆ bbsink_gzip_new()

bbsink* bbsink_gzip_new ( bbsink next,
pg_compress_specification compress 
)

Definition at line 62 of file basebackup_gzip.c.

63 {
64 #ifndef HAVE_LIBZ
65  ereport(ERROR,
66  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
67  errmsg("gzip compression is not supported by this build")));
68  return NULL; /* keep compiler quiet */
69 #else
70  bbsink_gzip *sink;
71  int compresslevel;
72 
73  Assert(next != NULL);
74 
75  compresslevel = compress->level;
76  Assert((compresslevel >= 1 && compresslevel <= 9) ||
78 
79  sink = palloc0(sizeof(bbsink_gzip));
80  *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_gzip_ops;
81  sink->base.bbs_next = next;
82  sink->compresslevel = compresslevel;
83 
84  return &sink->base;
85 #endif
86 }
static int32 next
Definition: blutils.c:219
int errcode(int sqlerrcode)
Definition: elog.c:858
int errmsg(const char *fmt,...)
Definition: elog.c:1069
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
Assert(fmt[strlen(fmt) - 1] !='\n')
void * palloc0(Size size)
Definition: mcxt.c:1241
#define Z_DEFAULT_COMPRESSION
static int compresslevel
Definition: pg_receivewal.c:45

References Assert(), compresslevel, ereport, errcode(), errmsg(), ERROR, pg_compress_specification::level, next, palloc0(), and Z_DEFAULT_COMPRESSION.

Referenced by SendBaseBackup().