/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. #ifndef NEBUAPPMONGO_DAEMONDEPLOYER_H_
  2. #define NEBUAPPMONGO_DAEMONDEPLOYER_H_
  3. #include "nebu-app-framework/daemonCollection.h"
  4. #include "nebu-app-framework/topologyManager.h"
  5. #include "nebu/virtualMachine.h"
  6. #include <map>
  7. #include <memory>
  8. #include <set>
  9. #include <vector>
  10. namespace nebu
  11. {
  12. namespace app
  13. {
  14. namespace mongo
  15. {
  16. class MongodDaemon;
  17. class ReplicaSetManager;
  18. class ReplicaSet;
  19. class DaemonDeployer
  20. {
  21. public:
  22. DaemonDeployer(std::shared_ptr<framework::DaemonCollection> daemonCollection,
  23. std::shared_ptr<ReplicaSetManager> replicaSetManager,
  24. std::shared_ptr<framework::TopologyManager> topologyManager);
  25. virtual ~DaemonDeployer() { };
  26. void deployDaemons();
  27. bool configServersActive();
  28. bool queryRouterActive();
  29. private:
  30. std::shared_ptr<framework::DaemonCollection> daemonCollection;
  31. std::shared_ptr<ReplicaSetManager> replicaSetManager;
  32. std::shared_ptr<framework::TopologyManager> topologyManager;
  33. void deployConfigServers();
  34. void deployQueryRouters();
  35. void deployDataServers();
  36. bool isAcceptableHostLocality(const std::set<std::shared_ptr<MongodDaemon>> &daemonList);
  37. bool isAcceptableRackLocality(const std::set<std::shared_ptr<MongodDaemon>> &daemonList);
  38. bool isAcceptableDataCenterLocality(const std::set<std::shared_ptr<MongodDaemon>> &daemonList);
  39. bool isAcceptableReplicaSet(std::set<std::shared_ptr<MongodDaemon>> daemonList);
  40. std::shared_ptr<ReplicaSet> selectReplicaSet(std::set<std::shared_ptr<MongodDaemon>> daemonList,
  41. unsigned int replicationFactor);
  42. struct Distance;
  43. struct DistanceParams;
  44. Distance distanceFunction(const DistanceParams &params, std::set<std::shared_ptr<MongodDaemon>> daemons);
  45. };
  46. }
  47. }
  48. }
  49. #endif