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-2020, 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 "access/xlogdefs.h"
16 #include "datatype/timestamp.h"
17 #include "libpq-fe.h"
18 
19 extern const char *progname;
20 extern char *connection_string;
21 extern char *dbhost;
22 extern char *dbuser;
23 extern char *dbport;
24 extern char *dbname;
25 extern int dbgetpassword;
26 extern uint32 WalSegSz;
27 
28 /* Connection kept global so we can disconnect easily */
29 extern PGconn *conn;
30 
31 extern PGconn *GetConnection(void);
32 
33 /* Replication commands */
34 extern bool CreateReplicationSlot(PGconn *conn, const char *slot_name,
35  const char *plugin, bool is_temporary,
36  bool is_physical, bool reserve_wal,
37  bool slot_exists_ok);
38 extern bool DropReplicationSlot(PGconn *conn, const char *slot_name);
39 extern bool RunIdentifySystem(PGconn *conn, char **sysid,
40  TimeLineID *starttli,
42  char **db_name);
43 extern bool RetrieveWalSegSize(PGconn *conn);
46  long *secs, int *microsecs);
47 
49  int msec);
50 extern void fe_sendint64(int64 i, char *buf);
51 extern int64 fe_recvint64(char *buf);
52 
53 #endif /* STREAMUTIL_H */
PGconn * conn
Definition: streamutil.c:54
int dbgetpassword
Definition: streamutil.c:52
uint32 WalSegSz
Definition: pg_standby.c:38
static const char * plugin
void feTimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
Definition: streamutil.c:627
char * dbport
Definition: streamutil.c:50
uint32 TimeLineID
Definition: xlogdefs.h:52
char * dbhost
Definition: streamutil.c:48
int64 TimestampTz
Definition: timestamp.h:39
const char * progname
Definition: pg_standby.c:36
static time_t start_time
Definition: pg_ctl.c:99
char * dbname
Definition: streamutil.c:51
static bool slot_exists_ok
Definition: pg_receivewal.c:41
char * dbuser
Definition: streamutil.c:49
static char * buf
Definition: pg_test_fsync.c:68
PGconn * GetConnection(void)
Definition: streamutil.c:62
unsigned int uint32
Definition: c.h:429
bool feTimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec)
Definition: streamutil.c:649
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:487
int64 fe_recvint64(char *buf)
Definition: streamutil.c:673
bool RetrieveWalSegSize(PGconn *conn)
Definition: streamutil.c:277
bool DropReplicationSlot(PGconn *conn, const char *slot_name)
Definition: streamutil.c:563
TimestampTz feGetCurrentTimestamp(void)
Definition: streamutil.c:608
void fe_sendint64(int64 i, char *buf)
Definition: streamutil.c:662
uint64 XLogRecPtr
Definition: xlogdefs.h:21
static XLogRecPtr startpos
char * connection_string
Definition: streamutil.c:47
int i
bool RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli, XLogRecPtr *startpos, char **db_name)
Definition: streamutil.c:409