flush [ci skip]
[awesomized/libmemcached] / testing / lib / Cluster.hpp
index d6a11a7ee79ea65e397d3fa0dfab03b997d88891..416da13849067386af93ad13b34c1b67aba5c3a0 100644 (file)
@@ -1,34 +1,33 @@
 #pragma once
 
+#include "common.hpp"
 #include "Server.hpp"
 
-#include <map>
-#include <thread>
-
 class Cluster {
-private:
-  uint16_t count;
-  Server proto;
-  vector<Server> cluster;
-
-  map<pid_t, Server *> pids;
-
 public:
   explicit
-  Cluster(Server &&serv, uint16_t cnt = 0)
-  : count{cnt}
-  , proto{serv}
-  {
-    if (!cnt) {
-      count = thread::hardware_concurrency() ?: 4;
-    }
-    reset();
-  }
+  Cluster(Server &&serv, uint16_t cnt = 0);
+
+  ~Cluster();
+
+  Cluster(const Cluster &c) = delete;
+  Cluster &operator = (const Cluster &c) = delete;
+
+  Cluster(Cluster &&c) = default;
+  Cluster &operator = (Cluster &&c) = default;
+
+  const vector<Server> &getServers() const;
 
   bool start();
   void stop();
   void reset();
   bool isStopped();
-  bool isListening(int max_timeout = 1000);
+  bool isListening();
   void wait();
+
+private:
+  uint16_t count;
+  Server proto;
+  vector<Server> cluster;
+  map<pid_t, Server *> pids;
 };