RDFS
The Rice Comp413 2017 class' continuation on the work of the 2016 RDFS.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
zk_client_common.h
1 // Copyright 2017 Rice University, COMP 413 2017
2 
3 #ifndef ZOOKEEPER_INCLUDE_ZK_CLIENT_COMMON_H_
4 #define ZOOKEEPER_INCLUDE_ZK_CLIENT_COMMON_H_
5 
6 #include <zkwrapper.h>
7 
8 #include <string>
9 
10 #include <boost/shared_ptr.hpp>
11 
12 namespace zkclient {
13 
15  public:
16  explicit ZkClientCommon(std::string hostAndIp);
17  explicit ZkClientCommon(std::shared_ptr<ZKWrapper> zk);
18 
19  void init();
20 
21 
27  static bool is_ec_block(u_int64_t block_id);
28 
36  std::string get_block_metadata_path(u_int64_t block_or_block_group_id);
37 
44  u_int64_t get_block_group_id(u_int64_t storage_block_id);
45 
51  u_int64_t get_index_within_block_group(u_int64_t storage_block_id);
52 
53  std::shared_ptr<ZKWrapper> zk;
54 
55  // constants used by the clients
56  static const char NAMESPACE_PATH[];
57  static const char BLOCKS_TREE[];
58  static const char HEALTH[];
59  static const char HEALTH_BACKSLASH[];
60  static const char STATS[];
61  static const char HEARTBEAT[];
62  static const char WORK_QUEUES[];
63  static const char REPLICATE_QUEUES[];
64  static const char REPLICATE_QUEUES_NO_BACKSLASH[];
65  static const char DELETE_QUEUES[];
66  static const char DELETE_QUEUES_NO_BACKSLASH[];
67  static const char WAIT_FOR_ACK[];
68  static const char WAIT_FOR_ACK_BACKSLASH[];
69  static const char REPLICATE_BACKSLASH[];
70  static const char BLOCK_LOCATIONS[];
71  static const char BLOCK_GROUP_LOCATIONS[];
72  static const char BLOCKS[];
73  static const char EC_RECOVER_QUEUES[];
74  static const char EC_RECOVER_QUEUES_NO_BACKSLASH[];
75  static const char LEASES[];
76  static const char CLIENTS[];
77 
78  private:
79  static const std::string CLASS_NAME;
80 };
81 } // namespace zkclient
82 
83 #endif // ZOOKEEPER_INCLUDE_ZK_CLIENT_COMMON_H_
Definition: zk_client_common.h:14
std::string get_block_metadata_path(u_int64_t block_or_block_group_id)
Definition: zk_client_common.cc:54
u_int64_t get_block_group_id(u_int64_t storage_block_id)
Definition: zk_client_common.cc:62
u_int64_t get_index_within_block_group(u_int64_t storage_block_id)
Definition: zk_client_common.cc:67
static bool is_ec_block(u_int64_t block_id)
Definition: zk_client_common.cc:48