#ifndef _SYNCREP_H
#define _SYNCREP_H
#include "access/xlogdefs.h"
#define SyncRepRequested() \
(max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH)
#define SYNC_REP_NO_WAIT (-1)
#define SYNC_REP_WAIT_WRITE 0
#define SYNC_REP_WAIT_FLUSH 1
#define SYNC_REP_WAIT_APPLY 2
#define NUM_SYNC_REP_WAIT_MODE 3
#define SYNC_REP_NOT_WAITING 0
#define SYNC_REP_WAITING 1
#define SYNC_REP_WAIT_COMPLETE 2
#define SYNC_REP_PRIORITY 0
#define SYNC_REP_QUORUM 1
typedef struct SyncRepStandbyData
{
pid_t pid;
XLogRecPtr write;
XLogRecPtr flush;
XLogRecPtr apply;
int sync_standby_priority;
int walsnd_index;
bool is_me;
} SyncRepStandbyData;
typedef struct SyncRepConfigData
{
int config_size;
int num_sync;
uint8 syncrep_method;
int nmembers;
char member_names[FLEXIBLE_ARRAY_MEMBER];
} SyncRepConfigData;
extern PGDLLIMPORT SyncRepConfigData *SyncRepConfig;
extern PGDLLIMPORT SyncRepConfigData *syncrep_parse_result;
extern PGDLLIMPORT char *syncrep_parse_error_msg;
extern PGDLLIMPORT char *SyncRepStandbyNames;
extern void SyncRepWaitForLSN(XLogRecPtr lsn, bool commit);
extern void SyncRepCleanupAtProcExit(void);
extern void SyncRepInitConfig(void);
extern void SyncRepReleaseWaiters(void);
extern int SyncRepGetCandidateStandbys(SyncRepStandbyData **standbys);
extern void SyncRepUpdateSyncStandbysDefined(void);
extern int syncrep_yyparse(void);
extern int syncrep_yylex(void);
extern void syncrep_yyerror(const char *str);
extern void syncrep_scanner_init(const char *str);
extern void syncrep_scanner_finish(void);
#endif