1 /*-------------------------------------------------------------------------
2  *
3  * receivelog.h
4  *
5  * Portions Copyright (c) 1996-2016, 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 
17 #include "access/xlogdefs.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
36 												 * often */
37 	bool		synchronous;	/* Flush data on write */
38 	bool		mark_done;		/* Mark segment as done in generated archive */
39 
40 	stream_stop_callback stream_stop;	/* Stop streaming when returns true */
41 
42 	char	   *basedir;		/* Received segments written to this dir */
43 	char	   *partial_suffix; /* Suffix appended to partially received files */
44 } StreamCtl;
45 
46 
47 
48 extern bool CheckServerVersionForStreaming(PGconn *conn);
49 extern bool ReceiveXlogStream(PGconn *conn,
50 				  StreamCtl *stream);
51 
52 #endif   /* RECEIVELOG_H */
53