-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyconfig.h
71 lines (63 loc) · 2.16 KB
/
myconfig.h
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
#ifndef MEMLINK_MYCONFIG_H
#define MEMLINK_MYCONFIG_H
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <ctype.h>
#include <pthread.h>
// TODO is there a pre-defined const for this?
#define IP_ADDR_MAX_LEN 16
#define BLOCK_DATA_COUNT_MAX 16
#define CONF_LOAD_ALL 1
#define CONF_LOAD_DYNAMIC 2
typedef struct _myconfig
{
unsigned int block_data_count[BLOCK_DATA_COUNT_MAX];
int block_data_count_items;
float block_data_reduce;
unsigned int dump_interval; // in minutes
float block_clean_cond;
int block_clean_start;
int block_clean_num;
char host[IP_ADDR_MAX_LEN];
int read_port;
int write_port;
int sync_port;
int heartbeat_port;
char datadir[PATH_MAX];
int log_level;
char log_name[PATH_MAX];
char log_error_name[PATH_MAX];
unsigned int log_size;
unsigned int log_time;
int log_count;
int log_rotate_type;
int write_binlog;
int timeout;
int heartbeat_timeout;
int backup_timeout;
int thread_num;
int max_conn; // max connection
int max_read_conn;
int max_write_conn;
int max_sync_conn;
int max_core; // maximize core file limit
long long max_mem; // maximize memory used
int is_daemon; // is run with daemon
char role; // 1 means master; 0 means slave
char master_sync_host[IP_ADDR_MAX_LEN];
int master_sync_port;
char vote_host[IP_ADDR_MAX_LEN];
int vote_port;
unsigned int sync_check_interval; // in seconds
unsigned int sync_disk_interval;
int sync_mode;
int dumpfile_num_max;
char user[128];
}MyConfig;
extern MyConfig *g_cf;
MyConfig* myconfig_create(char *filename);
int myconfig_change();
int myconfig_print(MyConfig *cf);
int myconfig_parser_create(MyConfig *cf, char *filepath, int loadflag);
#endif