summaryrefslogtreecommitdiffstats
path: root/src/bin/pg_basebackup/streamutil.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
commit5e45211a64149b3c659b90ff2de6fa982a5a93ed (patch)
tree739caf8c461053357daa9f162bef34516c7bf452 /src/bin/pg_basebackup/streamutil.h
parentInitial commit. (diff)
downloadpostgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.tar.xz
postgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.zip
Adding upstream version 15.5.upstream/15.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bin/pg_basebackup/streamutil.h')
-rw-r--r--src/bin/pg_basebackup/streamutil.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/bin/pg_basebackup/streamutil.h b/src/bin/pg_basebackup/streamutil.h
new file mode 100644
index 0000000..8638f81
--- /dev/null
+++ b/src/bin/pg_basebackup/streamutil.h
@@ -0,0 +1,68 @@
+/*-------------------------------------------------------------------------
+ *
+ * streamutil.h
+ *
+ * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ * src/bin/pg_basebackup/streamutil.h
+ *-------------------------------------------------------------------------
+ */
+
+#ifndef STREAMUTIL_H
+#define STREAMUTIL_H
+
+#include "access/xlogdefs.h"
+#include "datatype/timestamp.h"
+#include "libpq-fe.h"
+#include "pqexpbuffer.h"
+
+extern const char *progname;
+extern char *connection_string;
+extern char *dbhost;
+extern char *dbuser;
+extern char *dbport;
+extern char *dbname;
+extern int dbgetpassword;
+extern uint32 WalSegSz;
+
+/* Connection kept global so we can disconnect easily */
+extern PGconn *conn;
+
+extern PGconn *GetConnection(void);
+
+/* Replication commands */
+extern 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);
+extern bool DropReplicationSlot(PGconn *conn, const char *slot_name);
+extern bool RunIdentifySystem(PGconn *conn, char **sysid,
+ TimeLineID *starttli,
+ XLogRecPtr *startpos,
+ char **db_name);
+
+extern void AppendPlainCommandOption(PQExpBuffer buf,
+ bool use_new_option_syntax,
+ char *option_value);
+extern void AppendStringCommandOption(PQExpBuffer buf,
+ bool use_new_option_syntax,
+ char *option_name, char *option_value);
+extern void AppendIntegerCommandOption(PQExpBuffer buf,
+ bool use_new_option_syntax,
+ char *option_name, int32 option_value);
+
+extern bool GetSlotInformation(PGconn *conn, const char *slot_name,
+ XLogRecPtr *restart_lsn,
+ TimeLineID *restart_tli);
+extern bool RetrieveWalSegSize(PGconn *conn);
+extern TimestampTz feGetCurrentTimestamp(void);
+extern void feTimestampDifference(TimestampTz start_time, TimestampTz stop_time,
+ long *secs, int *microsecs);
+
+extern bool feTimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time,
+ int msec);
+extern void fe_sendint64(int64 i, char *buf);
+extern int64 fe_recvint64(char *buf);
+
+#endif /* STREAMUTIL_H */