Go to the source code of this file.
◆ bbstreamer_gzip_decompressor_new()
Definition at line 212 of file bbstreamer_gzip.c.
215 bbstreamer_gzip_decompressor *streamer;
220 streamer =
palloc0(
sizeof(bbstreamer_gzip_decompressor));
222 &bbstreamer_gzip_decompressor_ops;
224 streamer->base.bbs_next =
next;
228 zs = &streamer->zstream;
229 zs->zalloc = gzip_palloc;
230 zs->zfree = gzip_pfree;
231 zs->next_out = (
uint8 *) streamer->base.bbs_buffer.data;
232 zs->avail_out = streamer->base.bbs_buffer.maxlen;
244 if (inflateInit2(zs, 15 + 16) != Z_OK)
245 pg_fatal(
"could not initialize compression library");
247 return &streamer->base;
249 pg_fatal(
"this build does not support compression with %s",
"gzip");
if(TABLE==NULL||TABLE_index==NULL)
Assert(fmt[strlen(fmt) - 1] !='\n')
void * palloc0(Size size)
void initStringInfo(StringInfo str)
References Assert(), if(), initStringInfo(), next, palloc0(), and pg_fatal.
Referenced by CreateBackupStreamer().
◆ bbstreamer_gzip_writer_new()
Definition at line 79 of file bbstreamer_gzip.c.
83 bbstreamer_gzip_writer *streamer;
85 streamer =
palloc0(
sizeof(bbstreamer_gzip_writer));
87 &bbstreamer_gzip_writer_ops;
89 streamer->pathname =
pstrdup(pathname);
93 streamer->gzfile = gzopen(pathname,
"wb");
94 if (streamer->gzfile == NULL)
95 pg_fatal(
"could not create compressed file \"%s\": %m",
100 int fd = dup(fileno(file));
103 pg_fatal(
"could not duplicate stdout: %m");
105 streamer->gzfile = gzdopen(
fd,
"wb");
106 if (streamer->gzfile == NULL)
107 pg_fatal(
"could not open output file: %m");
110 if (gzsetparams(streamer->gzfile, compress->
level, Z_DEFAULT_STRATEGY) != Z_OK)
111 pg_fatal(
"could not set compression level %d: %s",
112 compress->
level, get_gz_error(streamer->gzfile));
114 return &streamer->base;
116 pg_fatal(
"this build does not support compression with %s",
"gzip");
char * pstrdup(const char *in)
static int fd(const char *x, int i)
References fd(), pg_compress_specification::level, palloc0(), pg_fatal, and pstrdup().
Referenced by CreateBackupStreamer().