8#include <sys/inotify.h> 
   13#include <unordered_map> 
   15#include <userver/engine/io/fd_poller.hpp> 
   16#include <userver/logging/fwd.hpp> 
   17#include <userver/utils/flags.hpp> 
   19USERVER_NAMESPACE_BEGIN
 
   21namespace engine::
io::sys::linux {
 
   27  kAttribChanged = IN_ATTRIB,
 
   28  kCloseWrite = IN_CLOSE_WRITE,
 
   29  kCloseNoWrite = IN_CLOSE_NOWRITE,
 
   32  kDeleteSelf = IN_DELETE_SELF,
 
   34  kMoveSelf = IN_MOVE_SELF,
 
   35  kMovedFrom = IN_MOVED_FROM,
 
   36  kMovedTo = IN_MOVED_TO,
 
   40  kOnlyDir = IN_ONLYDIR,  
 
   43std::string ToString(EventType);
 
   46using EventTypeMask = 
utils::Flags<EventType>;
 
   48std::string ToString(EventTypeMask);
 
   55  bool operator==(
const Event& other) 
const {
 
   56    return path == other.path && mask == other.mask;
 
   61                               const Event& event) 
noexcept;
 
   69  Inotify(
const Inotify&) = 
delete;
 
   71  Inotify(Inotify&&) = 
delete;
 
   75  Inotify& operator=(Inotify&&) = 
delete;
 
   77  Inotify& operator=(
const Inotify&) = 
delete;
 
   81  void AddWatch(
const std::string& path, EventTypeMask flags);
 
   84  void RmWatch(
const std::string& path);
 
   89  std::optional<Event> Poll(engine::Deadline deadline);
 
   95  std::queue<Event> pending_events_;
 
   96  std::unordered_map<std::string, 
int> path_to_wd_;
 
   97  std::unordered_map<
int, std::string> wd_to_path_;