PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
receivelog.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * receivelog.h
4  *
5  * Portions Copyright (c) 1996-2017, 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 "libpq-fe.h"
16 #include "walmethods.h"
17 
18 #include "access/xlogdefs.h"
19 
20 /*
21  * Called before trying to read more data or when a segment is
22  * finished. Return true to stop streaming.
23  */
24 typedef bool (*stream_stop_callback) (XLogRecPtr segendpos, uint32 timeline, bool segment_finished);
25 
26 /*
27  * Global parameters when receiving xlog stream. For details about the individual fields,
28  * see the function comment for ReceiveXlogStream().
29  */
30 typedef struct StreamCtl
31 {
32  XLogRecPtr startpos; /* Start position for streaming */
33  TimeLineID timeline; /* Timeline to stream data from */
34  char *sysidentifier; /* Validate this system identifier and
35  * timeline */
36  int standby_message_timeout; /* Send status messages this
37  * often */
38  bool synchronous; /* Flush immediately WAL data on write */
39  bool mark_done; /* Mark segment as done in generated archive */
40  bool do_sync; /* Flush to disk to ensure consistent state of
41  * data */
42 
43  stream_stop_callback stream_stop; /* Stop streaming when returns true */
44 
45  WalWriteMethod *walmethod; /* How to write the WAL */
46  char *partial_suffix; /* Suffix appended to partially received files */
47  char *replication_slot; /* Replication slot to use, or NULL */
48  bool temp_slot; /* Create temporary replication slot */
49 } StreamCtl;
50 
51 
52 
54 extern bool ReceiveXlogStream(PGconn *conn,
55  StreamCtl *stream);
56 
57 #endif /* RECEIVELOG_H */
uint32 TimeLineID
Definition: xlogdefs.h:45
bool CheckServerVersionForStreaming(PGconn *conn)
Definition: receivelog.c:360
bool do_sync
Definition: receivelog.h:40
char * sysidentifier
Definition: receivelog.h:34
XLogRecPtr startpos
Definition: receivelog.h:32
char * partial_suffix
Definition: receivelog.h:46
TimeLineID timeline
Definition: receivelog.h:33
char bool
Definition: c.h:202
PGconn * conn
Definition: streamutil.c:42
char * replication_slot
Definition: receivelog.h:47
bool mark_done
Definition: receivelog.h:39
unsigned int uint32
Definition: c.h:268
stream_stop_callback stream_stop
Definition: receivelog.h:43
WalWriteMethod * walmethod
Definition: receivelog.h:45
uint64 XLogRecPtr
Definition: xlogdefs.h:21
bool(* stream_stop_callback)(XLogRecPtr segendpos, uint32 timeline, bool segment_finished)
Definition: receivelog.h:24
bool synchronous
Definition: receivelog.h:38
struct StreamCtl StreamCtl
int standby_message_timeout
Definition: receivelog.h:36
bool temp_slot
Definition: receivelog.h:48
bool ReceiveXlogStream(PGconn *conn, StreamCtl *stream)
Definition: receivelog.c:433