summaryrefslogtreecommitdiff
path: root/contrib/pgxc_ctl/config.h
blob: 543070b91c9b0c7bfc402149cedd8240e47b7839 (plain)
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
/*-------------------------------------------------------------------------
 *
 * config.h
 *
 *    Configuration module of Postgres-XC configuration and operation tool.
 *
 * Copyright (c) 2013 Postgres-XC Development Group
 *
 *-------------------------------------------------------------------------
 */
#ifndef CONFIG_H
#define CONFIG_H

#include <stdio.h>
#include <string.h>

typedef enum NodeType {
	NodeType_UNDEF = 0, 
	NodeType_GTM, 
	NodeType_GTM_PROXY, 
	NodeType_COORDINATOR, 
	NodeType_DATANODE, 
	NodeType_SERVER} NodeType;

void read_vars(FILE *conf);
void check_configuration(void);
void read_selected_vars(FILE *conf, char *selectThis[]);
char *get_word(char *line, char **token);
int is_none(char *s);
int backup_configuration(void);
NodeType getNodeType(char *nodeName);
int checkSpecificResourceConflict(char *name, char *host, int port, char *dir, int is_gtm);
int checkNameConflict(char *name, int is_gtm);
int checkPortConflict(char *host, int port);
int checkDirConflict(char *host, char *dir);
void makeServerList(void);
int getDefaultWalSender(int isCoord);

#define DEBUG() (strcasecmp(sval(VAR_debug), "y") == 0)
#define VERBOSE() (strcasecmp(sval(VAR_verbose), "y") == 0)
#define isVarYes(x) ((sval(x) != NULL) && (strcasecmp(sval(x), "y") == 0))

void handle_no_slaves(void);

#endif /* CONFIG_H */