rasdaman complete source
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
rasmgr
rasmgr_config.hh
Go to the documentation of this file.
1
/*
2
* This file is part of rasdaman community.
3
*
4
* Rasdaman community is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* Rasdaman community is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16
*
17
* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18
rasdaman GmbH.
19
*
20
* For more information please see <http://www.rasdaman.org>
21
* or contact Peter Baumann via <baumann@rasdaman.com>.
22
/
36
#ifndef RASMGR_CONFIG_HH
37
#define RASMGR_CONFIG_HH
38
39
#include <iostream>
40
#include <string>
41
#include <sys/time.h>
42
#ifdef __APPLE__
43
#include <limits.h>
44
#else
45
#include <linux/limits.h> // PATH_MAX
46
#endif
47
48
#include "commline/cmlparser.hh"
49
50
// default rasmgr listen port polling frequency [secs]
51
// must be longer than the OS specific time to release TIM_WAIT sockets
52
const int DEFAULT_POLLING_FREQUENCY = 200;
53
// #define helps to avoid multiple defs in different .cc files:
54
#define DEFAULT_POLLING_FREQUENCY_STR "200"
55
57
#define HOSTNAME_SIZE 255
58
#define RASMGR_LOG_PREFIX "rasmgr"
59
63
class Configuration
64
{
65
public:
66
Configuration();
67
68
bool interpretArguments(int argc, char **argv,char **envp);
69
bool readConfigFile();
70
bool saveOrigConfigFile();
71
bool saveAltConfigFile();
72
const char *getAltConfigFileName();
73
const struct tm *getExpirationDate();
74
const char * getHostName();
75
const char * getPublicHostName();
76
int getListenPort();
77
78
const char * getMasterName();
79
int getMasterPort();
80
int getPollFrequency();
81
const char * getSlaveName();
82
bool isTestModus();
83
bool isDebugSupport();
84
bool isVerbose();
85
bool isLogToStdOut();
86
87
bool allowMultipleWriteTransactions();
88
89
void printStatus();
90
91
// DM: logging, adapted from rasserver_config.hh
92
void initLogFiles();
93
const char* makeLogFileName(const char *desExt);
94
95
private:
96
void printHelp();
97
98
char hostName[HOSTNAME_SIZE];
99
char publicHostName[HOSTNAME_SIZE]; // usually ==hostName, but you might want to publish IP address or hostname.domainname instead
100
int listenPort;
101
// name of configuration file
102
char configFileName[PATH_MAX];
103
// name of alternate configuration file for rescue save, generated by saveAltConfigFile()
104
char altConfigFileName[PATH_MAX];
105
106
// if slave
107
char masterName[HOSTNAME_SIZE];
108
int masterPort;
109
char slaveName[HOSTNAME_SIZE]; //my name, when I'm slave and no HIGHLANDER
110
111
int pollFrequency; // listen port polling frequency in seconds
112
bool testModus;
113
bool debugSupport;
114
bool verbose;
115
bool slave;
116
117
bool saveConfigFile();
118
119
bool rtHlTest;
120
bool allowMultiWT;
121
122
//interface program
123
CommandLineParser &cmlInter;
124
CommandLineParameter &cmlHelp, &cmlHostName, &cmlPort, &cmlPollFrequ;
125
CommandLineParameter &cmlMaster, &cmlMasterPort, &cmlName, &cmlQuiet, &cmlLog;
126
127
#ifdef RMANDEBUG
128
CommandLineParameter &cmlTest, &cmlDSup, &cmlRandTest, &cmlRth, &cmlMultiWT;
129
#endif
130
131
// logging variables
132
bool logToStdOut;
133
const char* logFileName; // == 0 if stdout
134
};
135
136
extern Configuration config;
137
141
class BenchmarkTimer
142
{
143
public:
144
BenchmarkTimer(const char *text);
145
~BenchmarkTimer();
146
void result();
147
private:
148
int timeval_subtract(timeval *result,timeval *x,timeval *y);
149
150
struct timeval start;
151
struct timeval end;
152
153
char* text;
154
155
};
156
#endif
Generated on Mon Jun 9 2014 03:00:30 for rasdaman complete source by
1.8.6