#ifndef __ETCD_WATCHER_HPP__ #define __ETCD_WATCHER_HPP__ #include #include "etcd/Response.hpp" #include #include "proto/rpc.grpc.pb.h" namespace etcdv3 { class AsyncWatchAction; } using etcdserverpb::KV; 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(); ~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 stub_; std::unique_ptr call; }; } #endif