#ifndef __ETCD_WATCHER_HPP__ #define __ETCD_WATCHER_HPP__ #include #include "etcd/Response.hpp" #include "v3/include/AsyncWatchAction.hpp" #include using etcdserverpb::Watch; using grpc::Channel; namespace etcd { class Watcher { public: Watcher(std::string const & etcd_url, std::string const & key, std::function callback); void Cancel(); void AddKey(std::string const & key); ~Watcher(); protected: void doWatch(std::string const & key, std::function callback); int index; std::function callback; pplx::task currentTask; std::unique_ptr watchServiceStub; std::unique_ptr call; }; } #endif