projects
/
awesomized
/
libmemcached
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
history
|
raw
|
HEAD
tests: investigating catch2
[awesomized/libmemcached]
/
testing
/
lib
/
Cluster.hpp
1
#pragma once
2
3
#include "Server.hpp"
4
5
#include <map>
6
#include <thread>
7
8
class Cluster {
9
private:
10
uint16_t count;
11
Server proto;
12
vector<Server> cluster;
13
14
map<pid_t, Server *> pids;
15
16
public:
17
explicit
18
Cluster(Server &&serv, uint16_t cnt = 0)
19
: count{cnt}
20
, proto{serv}
21
{
22
if (!cnt) {
23
count = thread::hardware_concurrency() ?: 4;
24
}
25
reset();
26
}
27
28
bool start();
29
void stop();
30
void reset();
31
bool isStopped();
32
bool isListening(int max_timeout = 1000);
33
void wait();
34
};