PageRenderTime 11ms CodeModel.GetById 5ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/include/daemonDeployer.h

https://github.com/deltaforge/nebu-app-mongo
C Header | 62 lines | 49 code | 13 blank | 0 comment | 0 complexity | ff52c030d24d30d240ab4d9d883f534e MD5 | raw file
 1
 2#ifndef NEBUAPPMONGO_DAEMONDEPLOYER_H_
 3#define NEBUAPPMONGO_DAEMONDEPLOYER_H_
 4
 5#include "nebu-app-framework/daemonCollection.h"
 6#include "nebu-app-framework/topologyManager.h"
 7#include "nebu/virtualMachine.h"
 8
 9#include <map>
10#include <memory>
11#include <set>
12#include <vector>
13
14namespace nebu
15{
16	namespace app
17	{
18		namespace mongo
19		{
20
21			class MongodDaemon;
22			class ReplicaSetManager;
23			class ReplicaSet;
24
25			class DaemonDeployer
26			{
27			public:
28				DaemonDeployer(std::shared_ptr<framework::DaemonCollection> daemonCollection,
29						std::shared_ptr<ReplicaSetManager> replicaSetManager,
30						std::shared_ptr<framework::TopologyManager> topologyManager);
31				virtual ~DaemonDeployer() { };
32
33				void deployDaemons();
34
35				bool configServersActive();
36				bool queryRouterActive();
37			private:
38				std::shared_ptr<framework::DaemonCollection> daemonCollection;
39				std::shared_ptr<ReplicaSetManager> replicaSetManager;
40				std::shared_ptr<framework::TopologyManager> topologyManager;
41
42				void deployConfigServers();
43				void deployQueryRouters();
44				void deployDataServers();
45
46				bool isAcceptableHostLocality(const std::set<std::shared_ptr<MongodDaemon>> &daemonList);
47				bool isAcceptableRackLocality(const std::set<std::shared_ptr<MongodDaemon>> &daemonList);
48				bool isAcceptableDataCenterLocality(const std::set<std::shared_ptr<MongodDaemon>> &daemonList);
49				bool isAcceptableReplicaSet(std::set<std::shared_ptr<MongodDaemon>> daemonList);
50				std::shared_ptr<ReplicaSet> selectReplicaSet(std::set<std::shared_ptr<MongodDaemon>> daemonList,
51						unsigned int replicationFactor);
52
53				struct Distance;
54				struct DistanceParams;
55				Distance distanceFunction(const DistanceParams &params, std::set<std::shared_ptr<MongodDaemon>> daemons);
56			};
57
58		}
59	}
60}
61
62#endif