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

Go to the source code of this file.

Functions

bbsinkbbsink_lz4_new (bbsink *next, pg_compress_specification *compress)
 

Function Documentation

◆ bbsink_lz4_new()

bbsink* bbsink_lz4_new ( bbsink next,
pg_compress_specification compress 
)

Definition at line 62 of file basebackup_lz4.c.

63 {
64 #ifndef USE_LZ4
65  ereport(ERROR,
66  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
67  errmsg("lz4 compression is not supported by this build")));
68  return NULL; /* keep compiler quiet */
69 #else
70  bbsink_lz4 *sink;
71  int compresslevel;
72 
73  Assert(next != NULL);
74 
75  compresslevel = compress->level;
76  Assert(compresslevel >= 0 && compresslevel <= 12);
77 
78  sink = palloc0(sizeof(bbsink_lz4));
79  *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_lz4_ops;
80  sink->base.bbs_next = next;
81  sink->compresslevel = compresslevel;
82 
83  return &sink->base;
84 #endif
85 }
static int32 next
Definition: blutils.c:221
#define Assert(condition)
Definition: c.h:858
int errcode(int sqlerrcode)
Definition: elog.c:859
int errmsg(const char *fmt,...)
Definition: elog.c:1072
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
void * palloc0(Size size)
Definition: mcxt.c:1346
static int compresslevel
Definition: pg_receivewal.c:45

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

Referenced by SendBaseBackup().