PostgreSQL Source Code  git master
streamutil.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * streamutil.h
4  *
5  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
6  *
7  * IDENTIFICATION
8  * src/bin/pg_basebackup/streamutil.h
9  *-------------------------------------------------------------------------
10  */
11 
12 #ifndef STREAMUTIL_H
13 #define STREAMUTIL_H
14 
15 #include "libpq-fe.h"
16 
17 #include "access/xlogdefs.h"
18 #include "datatype/timestamp.h"
19 
20 extern const char *progname;
21 extern char *connection_string;
22 extern char *dbhost;
23 extern char *dbuser;
24 extern char *dbport;
25 extern char *dbname;
26 extern int dbgetpassword;
27 extern uint32 WalSegSz;
28 
29 /* Connection kept global so we can disconnect easily */
30 extern PGconn *conn;
31 
32 extern PGconn *GetConnection(void);
33 
34 /* Replication commands */
35 extern bool CreateReplicationSlot(PGconn *conn, const char *slot_name,
36  const char *plugin, bool is_temporary,
37  bool is_physical, bool reserve_wal,
38  bool slot_exists_ok);
39 extern bool DropReplicationSlot(PGconn *conn, const char *slot_name);
40 extern bool RunIdentifySystem(PGconn *conn, char **sysid,
41  TimeLineID *starttli,
43  char **db_name);
44 extern bool RetrieveWalSegSize(PGconn *conn);
47  long *secs, int *microsecs);
48 
50  int msec);
51 extern void fe_sendint64(int64 i, char *buf);
52 extern int64 fe_recvint64(char *buf);
53 
54 #endif /* STREAMUTIL_H */
PGconn * conn
Definition: streamutil.c:46
int dbgetpassword
Definition: streamutil.c:43
uint32 WalSegSz
Definition: pg_standby.c:39
static const char * plugin
void feTimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
Definition: streamutil.c:539
char * dbport
Definition: streamutil.c:41
uint32 TimeLineID
Definition: xlogdefs.h:45
char * dbhost
Definition: streamutil.c:39
int64 TimestampTz
Definition: timestamp.h:39
const char * progname
Definition: pg_standby.c:37
static time_t start_time
Definition: pg_ctl.c:95
char * dbname
Definition: streamutil.c:42
static bool slot_exists_ok
Definition: pg_receivewal.c:41
char * dbuser
Definition: streamutil.c:40
static char * buf
Definition: pg_test_fsync.c:67
PGconn * GetConnection(void)
Definition: streamutil.c:54
unsigned int uint32
Definition: c.h:296
bool feTimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec)
Definition: streamutil.c:561
bool CreateReplicationSlot(PGconn *conn, const char *slot_name, const char *plugin, bool is_temporary, bool is_physical, bool reserve_wal, bool slot_exists_ok)
Definition: streamutil.c:397
int64 fe_recvint64(char *buf)
Definition: streamutil.c:585
bool RetrieveWalSegSize(PGconn *conn)
Definition: streamutil.c:242
bool DropReplicationSlot(PGconn *conn, const char *slot_name)
Definition: streamutil.c:474
TimestampTz feGetCurrentTimestamp(void)
Definition: streamutil.c:520
void fe_sendint64(int64 i, char *buf)
Definition: streamutil.c:574
uint64 XLogRecPtr
Definition: xlogdefs.h:21
static XLogRecPtr startpos
char * connection_string
Definition: streamutil.c:38
int i
bool RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli, XLogRecPtr *startpos, char **db_name)
Definition: streamutil.c:316