PostgreSQL Source Code  git master
astreamer_inject.h File Reference
#include "fe_utils/astreamer.h"
#include "pqexpbuffer.h"
Include dependency graph for astreamer_inject.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

astreamerastreamer_recovery_injector_new (astreamer *next, bool is_recovery_guc_supported, PQExpBuffer recoveryconfcontents)
 
void astreamer_inject_file (astreamer *streamer, char *pathname, char *data, int len)
 

Function Documentation

◆ astreamer_inject_file()

void astreamer_inject_file ( astreamer streamer,
char *  pathname,
char *  data,
int  len 
)

Definition at line 219 of file astreamer_inject.c.

221 {
222  astreamer_member member;
223 
224  strlcpy(member.pathname, pathname, MAXPGPATH);
225  member.size = len;
226  member.mode = pg_file_create_mode;
227  member.is_directory = false;
228  member.is_link = false;
229  member.linktarget[0] = '\0';
230 
231  /*
232  * There seems to be no principled argument for these values, but they are
233  * what PostgreSQL has historically used.
234  */
235  member.uid = 04000;
236  member.gid = 02000;
237 
238  /*
239  * We don't know here how to generate valid member headers and trailers
240  * for the archiving format in use, so if those are needed, some successor
241  * astreamer will have to generate them using the data from 'member'.
242  */
243  astreamer_content(streamer, &member, NULL, 0,
245  astreamer_content(streamer, &member, data, len,
247  astreamer_content(streamer, &member, NULL, 0,
249 }
static void astreamer_content(astreamer *streamer, astreamer_member *member, const char *data, int len, astreamer_archive_context context)
Definition: astreamer.h:135
@ ASTREAMER_MEMBER_HEADER
Definition: astreamer.h:65
@ ASTREAMER_MEMBER_CONTENTS
Definition: astreamer.h:66
@ ASTREAMER_MEMBER_TRAILER
Definition: astreamer.h:67
int pg_file_create_mode
Definition: file_perm.c:19
#define MAXPGPATH
const void size_t len
const void * data
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
char linktarget[MAXPGPATH]
Definition: astreamer.h:88
char pathname[MAXPGPATH]
Definition: astreamer.h:81
pgoff_t size
Definition: astreamer.h:82

References astreamer_content(), ASTREAMER_MEMBER_CONTENTS, ASTREAMER_MEMBER_HEADER, ASTREAMER_MEMBER_TRAILER, data, astreamer_member::gid, astreamer_member::is_directory, astreamer_member::is_link, len, astreamer_member::linktarget, MAXPGPATH, astreamer_member::mode, astreamer_member::pathname, pg_file_create_mode, astreamer_member::size, strlcpy(), and astreamer_member::uid.

Referenced by astreamer_recovery_injector_content(), ReceiveArchiveStream(), and ReceiveTarFile().

◆ astreamer_recovery_injector_new()

astreamer* astreamer_recovery_injector_new ( astreamer next,
bool  is_recovery_guc_supported,
PQExpBuffer  recoveryconfcontents 
)

Definition at line 65 of file astreamer_inject.c.

68 {
70 
71  streamer = palloc0(sizeof(astreamer_recovery_injector));
72  *((const astreamer_ops **) &streamer->base.bbs_ops) =
74  streamer->base.bbs_next = next;
75  streamer->is_recovery_guc_supported = is_recovery_guc_supported;
77 
78  return &streamer->base;
79 }
static const astreamer_ops astreamer_recovery_injector_ops
static int32 next
Definition: blutils.c:222
void * palloc0(Size size)
Definition: mcxt.c:1347
static PQExpBuffer recoveryconfcontents
const astreamer_ops * bbs_ops
Definition: astreamer.h:109
astreamer * bbs_next
Definition: astreamer.h:110

References astreamer_recovery_injector_ops, astreamer_recovery_injector::base, astreamer::bbs_next, astreamer::bbs_ops, astreamer_recovery_injector::is_recovery_guc_supported, next, palloc0(), astreamer_recovery_injector::recoveryconfcontents, and recoveryconfcontents.

Referenced by CreateBackupStreamer().