Go to the source code of this file.
◆ astreamer_gzip_decompressor_new()
Definition at line 238 of file astreamer_gzip.c.
241 astreamer_gzip_decompressor *streamer;
246 streamer =
palloc0(
sizeof(astreamer_gzip_decompressor));
248 &astreamer_gzip_decompressor_ops;
250 streamer->base.bbs_next =
next;
254 zs = &streamer->zstream;
255 zs->zalloc = gzip_palloc;
256 zs->zfree = gzip_pfree;
257 zs->next_out = (
uint8 *) streamer->base.bbs_buffer.data;
258 zs->avail_out = streamer->base.bbs_buffer.maxlen;
270 if (inflateInit2(zs, 15 + 16) != Z_OK)
271 pg_fatal(
"could not initialize compression library");
273 return &streamer->base;
275 pg_fatal(
"this build does not support compression with %s",
"gzip");
#define Assert(condition)
if(TABLE==NULL||TABLE_index==NULL)
void * palloc0(Size size)
void initStringInfo(StringInfo str)
References Assert, if(), initStringInfo(), next, palloc0(), and pg_fatal.
Referenced by create_archive_verifier(), and CreateBackupStreamer().
◆ astreamer_gzip_writer_new()
Definition at line 101 of file astreamer_gzip.c.
105 astreamer_gzip_writer *streamer;
107 streamer =
palloc0(
sizeof(astreamer_gzip_writer));
109 &astreamer_gzip_writer_ops;
111 streamer->pathname =
pstrdup(pathname);
115 streamer->gzfile = gzopen(pathname,
"wb");
116 if (streamer->gzfile == NULL)
117 pg_fatal(
"could not create compressed file \"%s\": %m",
126 int fd = dup(fileno(file));
129 pg_fatal(
"could not duplicate stdout: %m");
131 streamer->gzfile = gzdopen(
fd,
"wb");
132 if (streamer->gzfile == NULL)
133 pg_fatal(
"could not open output file: %m");
136 if (gzsetparams(streamer->gzfile, compress->
level, Z_DEFAULT_STRATEGY) != Z_OK)
137 pg_fatal(
"could not set compression level %d: %s",
138 compress->
level, get_gz_error(streamer->gzfile));
140 return &streamer->base;
142 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().