Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/config/core/v3/base.pb.h" 4 : #include "envoy/event/dispatcher.h" 5 : #include "envoy/filesystem/watcher.h" 6 : 7 : namespace Envoy { 8 : namespace Config { 9 : 10 : // Implement the common functionality of envoy::config::core::v3::WatchedDirectory. 11 : class WatchedDirectory { 12 : public: 13 : using Callback = std::function<void()>; 14 : 15 : WatchedDirectory(const envoy::config::core::v3::WatchedDirectory& config, 16 : Event::Dispatcher& dispatcher); 17 : 18 0 : void setCallback(Callback cb) { cb_ = cb; } 19 : 20 : private: 21 : std::unique_ptr<Filesystem::Watcher> watcher_; 22 : Callback cb_; 23 : }; 24 : 25 : using WatchedDirectoryPtr = std::unique_ptr<WatchedDirectory>; 26 : 27 : } // namespace Config 28 : } // namespace Envoy