RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
00001 00008 #ifndef __service__zookeeper_configuration_service_h__ 00009 #define __service__zookeeper_configuration_service_h__ 00010 00011 00012 #include "service_base.h" 00013 #include <memory> 00014 00015 00016 namespace Datacratic { 00017 00018 struct ZookeeperConnection; 00019 00020 /*****************************************************************************/ 00021 /* ZOOKEEPER CONFIGURATION SERVICE */ 00022 /*****************************************************************************/ 00023 00026 struct ZookeeperConfigurationService 00027 : public ConfigurationService { 00028 00029 ZookeeperConfigurationService(); 00030 00031 ZookeeperConfigurationService(const std::string & host, 00032 const std::string & prefix, 00033 int timeout = 5); 00034 00035 ~ZookeeperConfigurationService(); 00036 00037 void init(const std::string & host, 00038 const std::string & prefix, 00039 int timeout = 5); 00040 00041 virtual Json::Value getJson(const std::string & value, 00042 Watch watch = Watch()); 00043 00044 virtual void set(const std::string & key, 00045 const Json::Value & value); 00046 00047 virtual std::string setUnique(const std::string & key, 00048 const Json::Value & value); 00049 00050 virtual std::vector<std::string> 00051 getChildren(const std::string & key, 00052 Watch watch = Watch()); 00053 00054 virtual bool forEachEntry(const OnEntry & onEntry, 00055 const std::string & startPrefix = "") const; 00056 00058 virtual void removePath(const std::string & path); 00059 00060 private: 00061 std::unique_ptr<ZookeeperConnection> zoo; 00062 std::string prefix; 00063 }; 00064 00065 00066 } // namespace Datacratic 00067 00068 00069 #endif /* __service__zookeeper_configuration_service_h__ */