1 | #pragma once |
2 | |
3 | #include <common/Types.h> |
4 | #include <future> |
5 | #include <memory> |
6 | #include <vector> |
7 | #include <Common/ZooKeeper/IKeeper.h> |
8 | #include <Poco/Event.h> |
9 | |
10 | |
11 | namespace zkutil |
12 | { |
13 | |
14 | using Strings = std::vector<std::string>; |
15 | |
16 | |
17 | namespace CreateMode |
18 | { |
19 | extern const int Persistent; |
20 | extern const int Ephemeral; |
21 | extern const int EphemeralSequential; |
22 | extern const int PersistentSequential; |
23 | } |
24 | |
25 | using EventPtr = std::shared_ptr<Poco::Event>; |
26 | |
27 | /// Gets multiple asynchronous results |
28 | /// Each pair, the first is path, the second is response eg. CreateResponse, RemoveResponse |
29 | template <typename R> |
30 | using AsyncResponses = std::vector<std::pair<std::string, std::future<R>>>; |
31 | |
32 | Coordination::RequestPtr makeCreateRequest(const std::string & path, const std::string & data, int create_mode); |
33 | Coordination::RequestPtr makeRemoveRequest(const std::string & path, int version); |
34 | Coordination::RequestPtr makeSetRequest(const std::string & path, const std::string & data, int version); |
35 | Coordination::RequestPtr makeCheckRequest(const std::string & path, int version); |
36 | |
37 | } |
38 | |