testing: udp flag must be set prior adding servers
[awesomized/libmemcached] / test / lib / MemcachedCluster.hpp
1 #pragma once
2
3 #include "common.hpp"
4 #include "Cluster.hpp"
5 #include "ReturnMatcher.hpp"
6
7
8 class MemcachedCluster {
9 public:
10 using behavior_t = pair<memcached_behavior_t, uint64_t>;
11 using behaviors_t = vector<behavior_t>;
12
13 Cluster cluster;
14 memcached_st memc{empty_memc};
15 ReturnMatcher returns{&memc};
16
17 MemcachedCluster();
18 explicit MemcachedCluster(Cluster &&cluster, behaviors_t to_set = {});
19 ~MemcachedCluster();
20
21 MemcachedCluster(const MemcachedCluster &) = delete;
22 MemcachedCluster &operator=(const MemcachedCluster &) = delete;
23
24 MemcachedCluster(MemcachedCluster &&mc);
25 MemcachedCluster &operator=(MemcachedCluster &&mc);
26
27 void enableBinaryProto(bool enable = true);
28 void enableBuffering(bool enable = true);
29 void enableReplication();
30 void enableUdp(bool enable = true);
31 void flush();
32
33 static MemcachedCluster mixed();
34 static MemcachedCluster network();
35 static MemcachedCluster socket();
36 static MemcachedCluster udp();
37
38 #if LIBMEMCACHED_WITH_SASL_SUPPORT
39 static MemcachedCluster sasl();
40 #endif
41
42 void killOneServer();
43
44 private:
45 behaviors_t to_set;
46 static const memcached_st empty_memc;
47
48 void init();
49 };