Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*-------------------------------------------------------------------------
 *
 * streamutil.h
 *
 * Portions Copyright (c) 1996-2026, 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 int  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,
                                  bool failover);
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 AppendQuotedString(PQExpBuffer buf, const char *str, char quote);
#define AppendQuotedIdentifier(b, s)    AppendQuotedString(b, s, '"')
#define AppendQuotedLiteral(b, s)       AppendQuotedString(b, s, '\'')
extern void AppendPlainCommandOption(PQExpBuffer buf,
                                     bool use_new_option_syntax,
                                     const char *option_name);
extern void AppendStringCommandOption(PQExpBuffer buf,
                                      bool use_new_option_syntax,
                                      const char *option_name,
                                      const char *option_value);
extern void AppendIntegerCommandOption(PQExpBuffer buf,
                                       bool use_new_option_syntax,
                                       const 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 */