Configuration.h 2.88 KB
Newer Older
1
2
3
//================================================================================
// Name        : Configuration.h
// Author      : Michael Ott, Micha Mueller
Micha Müller's avatar
Micha Müller committed
4
// Contact     : info@dcdb.it
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright   : Leibniz Supercomputing Centre
// Description : Class responsible for reading dcdb-pusher specific configuration.
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2017-2019 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//================================================================================
27
28
29
30

#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_

31
32
#include "globalconfiguration.h"

33
34
#include <set>

35
#include "PluginManager.h"
36

37
38
#define DEFAULT_BROKERPORT 1883
#define DEFAULT_BROKERHOST "127.0.0.1"
39

40
41
42
43
44
/**
 * @brief Class responsible for reading dcdb-pusher specific configuration.
 *
 * @ingroup pusher
 */
Alessio Netti's avatar
Alessio Netti committed
45
class Configuration : public GlobalConfiguration {
46
47

      public:
48
	/**
Alessio Netti's avatar
Alessio Netti committed
49
50
51
52
53
     * Create new Configuration. Sets global config file to read from to cfgFile.
     * 
     * @param cfgFilePath	Path to where all config-files are located
     * @param cfgFileName   Name of the file containing the config
     */
54
55
56
	Configuration(const std::string &cfgFilePath, const std::string &cfgFileName)
	    : GlobalConfiguration(cfgFilePath, cfgFileName) {}

57
	virtual ~Configuration() {}
58

59
	/**
60
	 * Reads the plugin configuration section from global.conf (located at _cfgFilePath).
61
62
63
	 * Triggers the pluginManager to load plugins as required.
	 *
	 * @param pluginManager The pluginManager object to store plugins.
64
65
66
	 *
	 * @return	true on success, false otherwise
	 */
67
68
	bool readPlugins(PluginManager &pluginManager);

Alessio Netti's avatar
Alessio Netti committed
69
	// Additional configuration parameters to be parsed and stored in the global block
70
	int          qosLevel = 1;
Alessio Netti's avatar
Alessio Netti committed
71
72
	unsigned int maxInflightMsgNum = 20;
	unsigned int maxQueuedMsgNum = 0;
73
74
	int          brokerPort = DEFAULT_BROKERPORT;
	std::string  brokerHost = DEFAULT_BROKERHOST;
75
	int          maxMsgNum = 0;
Alessio Netti's avatar
Alessio Netti committed
76

77
      protected:
Alessio Netti's avatar
Alessio Netti committed
78
	bool readAdditionalValues(boost::property_tree::iptree::value_type &global) override;
79
80
81
};

#endif /* CONFIGURATION_H_ */