PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
streamutil.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * streamutil.h
4 *
5 * Portions Copyright (c) 1996-2024, 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#include "pqexpbuffer.h"
19
20extern const char *progname;
21extern char *connection_string;
22extern char *dbhost;
23extern char *dbuser;
24extern char *dbport;
25extern char *dbname;
26extern int dbgetpassword;
27extern int WalSegSz;
28
29/* Connection kept global so we can disconnect easily */
30extern PGconn *conn;
31
32extern PGconn *GetConnection(void);
33
34extern char *GetDbnameFromConnectionOptions(void);
35
36/* Replication commands */
37extern bool CreateReplicationSlot(PGconn *conn, const char *slot_name,
38 const char *plugin, bool is_temporary,
39 bool is_physical, bool reserve_wal,
40 bool slot_exists_ok, bool two_phase);
41extern bool DropReplicationSlot(PGconn *conn, const char *slot_name);
42extern bool RunIdentifySystem(PGconn *conn, char **sysid,
43 TimeLineID *starttli,
45 char **db_name);
46
48 bool use_new_option_syntax,
49 char *option_name);
51 bool use_new_option_syntax,
52 char *option_name, char *option_value);
54 bool use_new_option_syntax,
55 char *option_name, int32 option_value);
56
57extern bool GetSlotInformation(PGconn *conn, const char *slot_name,
58 XLogRecPtr *restart_lsn,
59 TimeLineID *restart_tli);
60extern bool RetrieveWalSegSize(PGconn *conn);
63 long *secs, int *microsecs);
64
66 int msec);
67extern void fe_sendint64(int64 i, char *buf);
68extern int64 fe_recvint64(char *buf);
69
70#endif /* STREAMUTIL_H */
int64_t int64
Definition: c.h:482
int32_t int32
Definition: c.h:481
int64 TimestampTz
Definition: timestamp.h:39
int i
Definition: isn.c:72
static time_t start_time
Definition: pg_ctl.c:95
static bool slot_exists_ok
Definition: pg_receivewal.c:50
static bool two_phase
static const char * plugin
static XLogRecPtr startpos
static char * buf
Definition: pg_test_fsync.c:72
void AppendIntegerCommandOption(PQExpBuffer buf, bool use_new_option_syntax, char *option_name, int32 option_value)
Definition: streamutil.c:854
int dbgetpassword
Definition: streamutil.c:51
PGconn * GetConnection(void)
Definition: streamutil.c:61
bool RetrieveWalSegSize(PGconn *conn)
Definition: streamutil.c:345
int WalSegSz
Definition: streamutil.c:32
char * dbhost
Definition: streamutil.c:47
int64 fe_recvint64(char *buf)
Definition: streamutil.c:932
bool CreateReplicationSlot(PGconn *conn, const char *slot_name, const char *plugin, bool is_temporary, bool is_physical, bool reserve_wal, bool slot_exists_ok, bool two_phase)
Definition: streamutil.c:653
TimestampTz feGetCurrentTimestamp(void)
Definition: streamutil.c:867
char * dbport
Definition: streamutil.c:49
char * GetDbnameFromConnectionOptions(void)
Definition: streamutil.c:306
void feTimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
Definition: streamutil.c:886
void AppendPlainCommandOption(PQExpBuffer buf, bool use_new_option_syntax, char *option_name)
Definition: streamutil.c:810
void AppendStringCommandOption(PQExpBuffer buf, bool use_new_option_syntax, char *option_name, char *option_value)
Definition: streamutil.c:831
void fe_sendint64(int64 i, char *buf)
Definition: streamutil.c:921
char * connection_string
Definition: streamutil.c:46
bool feTimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec)
Definition: streamutil.c:908
bool GetSlotInformation(PGconn *conn, const char *slot_name, XLogRecPtr *restart_lsn, TimeLineID *restart_tli)
Definition: streamutil.c:559
const char * progname
Definition: main.c:44
bool DropReplicationSlot(PGconn *conn, const char *slot_name)
Definition: streamutil.c:761
char * dbname
Definition: streamutil.c:50
PGconn * conn
Definition: streamutil.c:53
bool RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli, XLogRecPtr *startpos, char **db_name)
Definition: streamutil.c:478
char * dbuser
Definition: streamutil.c:48
uint64 XLogRecPtr
Definition: xlogdefs.h:21
uint32 TimeLineID
Definition: xlogdefs.h:59