| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * streamutil.h |
| 4 | * |
| 5 | * Portions Copyright (c) 1996-2019, 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, |
| 42 | XLogRecPtr *startpos, |
| 43 | char **db_name); |
| 44 | extern bool RetrieveWalSegSize(PGconn *conn); |
| 45 | extern TimestampTz feGetCurrentTimestamp(void); |
| 46 | extern void feTimestampDifference(TimestampTz start_time, TimestampTz stop_time, |
| 47 | long *secs, int *microsecs); |
| 48 | |
| 49 | extern bool feTimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, |
| 50 | int msec); |
| 51 | extern void fe_sendint64(int64 i, char *buf); |
| 52 | extern int64 fe_recvint64(char *buf); |
| 53 | |
| 54 | #endif /* STREAMUTIL_H */ |
| 55 | |