PostgreSQL Source Code git master
Loading...
Searching...
No Matches
streamutil.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * streamutil.h
4 *
5 * Portions Copyright (c) 1996-2026, 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
34/* Replication commands */
35extern 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, bool two_phase,
39 bool failover);
40extern bool DropReplicationSlot(PGconn *conn, const char *slot_name);
41extern bool RunIdentifySystem(PGconn *conn, char **sysid,
42 TimeLineID *starttli,
44 char **db_name);
45
46extern void AppendQuotedString(PQExpBuffer buf, const char *str, char quote);
47#define AppendQuotedIdentifier(b, s) AppendQuotedString(b, s, '"')
48#define AppendQuotedLiteral(b, s) AppendQuotedString(b, s, '\'')
49extern void AppendPlainCommandOption(PQExpBuffer buf,
50 bool use_new_option_syntax,
51 const char *option_name);
52extern void AppendStringCommandOption(PQExpBuffer buf,
53 bool use_new_option_syntax,
54 const char *option_name,
55 const char *option_value);
56extern void AppendIntegerCommandOption(PQExpBuffer buf,
57 bool use_new_option_syntax,
58 const char *option_name,
59 int32 option_value);
60
61extern bool GetSlotInformation(PGconn *conn, const char *slot_name,
62 XLogRecPtr *restart_lsn,
63 TimeLineID *restart_tli);
64extern bool RetrieveWalSegSize(PGconn *conn);
65extern TimestampTz feGetCurrentTimestamp(void);
66extern void feTimestampDifference(TimestampTz start_time, TimestampTz stop_time,
67 long *secs, int *microsecs);
68
69extern bool feTimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time,
70 int msec);
71extern void fe_sendint64(int64 i, char *buf);
72extern int64 fe_recvint64(char *buf);
73
74#endif /* STREAMUTIL_H */
const char * str
static bool slot_exists_ok
static bool two_phase
static bool failover
static const char * plugin
static XLogRecPtr startpos
static char buf[DEFAULT_XLOG_SEG_SIZE]
static int fb(int x)
int dbgetpassword
Definition streamutil.c:50
PGconn * GetConnection(void)
Definition streamutil.c:60
int WalSegSz
Definition streamutil.c:32
char * dbhost
Definition streamutil.c:46
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, bool failover)
Definition streamutil.c:585
char * dbport
Definition streamutil.c:48
void AppendQuotedString(PQExpBuffer buf, const char *str, char quote)
Definition streamutil.c:750
char * connection_string
Definition streamutil.c:45
const char * progname
Definition main.c:44
bool DropReplicationSlot(PGconn *conn, const char *slot_name)
Definition streamutil.c:702
char * dbname
Definition streamutil.c:49
PGconn * conn
Definition streamutil.c:52
bool RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli, XLogRecPtr *startpos, char **db_name)
Definition streamutil.c:409
char * dbuser
Definition streamutil.c:47
uint64 XLogRecPtr
Definition xlogdefs.h:21
uint32 TimeLineID
Definition xlogdefs.h:63