PostgreSQL Source Code  git master
receivelog.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * receivelog.h
4  *
5  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
6  *
7  * IDENTIFICATION
8  * src/bin/pg_basebackup/receivelog.h
9  *-------------------------------------------------------------------------
10  */
11 
12 #ifndef RECEIVELOG_H
13 #define RECEIVELOG_H
14 
15 #include "access/xlogdefs.h"
16 #include "libpq-fe.h"
17 #include "walmethods.h"
18 
19 /*
20  * Called before trying to read more data or when a segment is
21  * finished. Return true to stop streaming.
22  */
23 typedef bool (*stream_stop_callback) (XLogRecPtr segendpos, uint32 timeline, bool segment_finished);
24 
25 /*
26  * Global parameters when receiving xlog stream. For details about the individual fields,
27  * see the function comment for ReceiveXlogStream().
28  */
29 typedef struct StreamCtl
30 {
31  XLogRecPtr startpos; /* Start position for streaming */
32  TimeLineID timeline; /* Timeline to stream data from */
33  char *sysidentifier; /* Validate this system identifier and
34  * timeline */
35  int standby_message_timeout; /* Send status messages this often */
36  bool synchronous; /* Flush immediately WAL data on write */
37  bool mark_done; /* Mark segment as done in generated archive */
38  bool do_sync; /* Flush to disk to ensure consistent state of
39  * data */
40 
41  stream_stop_callback stream_stop; /* Stop streaming when returns true */
42 
43  pgsocket stop_socket; /* if valid, watch for input on this socket
44  * and check stream_stop() when there is any */
45 
46  WalWriteMethod *walmethod; /* How to write the WAL */
47  char *partial_suffix; /* Suffix appended to partially received files */
48  char *replication_slot; /* Replication slot to use, or NULL */
49 } StreamCtl;
50 
51 
52 
54 extern bool ReceiveXlogStream(PGconn *conn,
55  StreamCtl *stream);
56 
57 #endif /* RECEIVELOG_H */
uint32 TimeLineID
Definition: xlogdefs.h:52
bool CheckServerVersionForStreaming(PGconn *conn)
Definition: receivelog.c:358
bool do_sync
Definition: receivelog.h:38
char * sysidentifier
Definition: receivelog.h:33
XLogRecPtr startpos
Definition: receivelog.h:31
char * partial_suffix
Definition: receivelog.h:47
TimeLineID timeline
Definition: receivelog.h:32
PGconn * conn
Definition: streamutil.c:54
char * replication_slot
Definition: receivelog.h:48
bool mark_done
Definition: receivelog.h:37
bool(* stream_stop_callback)(XLogRecPtr segendpos, uint32 timeline, bool segment_finished)
Definition: receivelog.h:23
unsigned int uint32
Definition: c.h:367
int pgsocket
Definition: port.h:31
stream_stop_callback stream_stop
Definition: receivelog.h:41
WalWriteMethod * walmethod
Definition: receivelog.h:46
uint64 XLogRecPtr
Definition: xlogdefs.h:21
bool synchronous
Definition: receivelog.h:36
pgsocket stop_socket
Definition: receivelog.h:43
struct StreamCtl StreamCtl
int standby_message_timeout
Definition: receivelog.h:35
bool ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
Definition: receivelog.c:436
unsigned char bool
Definition: c.h:317