text: #pragma once
  
  #include <cstdint>
  #include <functional>
  #include <memory>
  #include <string>
  
  #include "envoy/common/pure.h"
  
  #include "absl/strings/string_view.h"
  
  namespace Envoy {
  namespace Filesystem {
  
  /**
   * Abstraction for a file on disk.
   */
  class File {
  public:
    virtual ~File() {}
  
    /**
     * Write data to the file.
     */
    virtual void write(absl::string_view) PURE;
  
    /**
     * Reopen the file.
     */
    virtual void reopen() PURE;
  
    /**
     * Synchronously flush all pending data to disk.
     */
    virtual void flush() PURE;
  };
  
  typedef std::shared_ptr<File> FileSharedPtr;
  
  /**
   * Abstraction for a file watcher.
   */
  class Watcher {
  public:
    typedef std::function<void(uint32_t events)> OnChangedCb;
  
    struct Events {
      static const uint32_t MovedTo = 0x1;
    };
  
    virtual ~Watcher() {}
  
    /**
     * Add a file watch.
     * @param path supplies the path to watch.
     * @param events supplies the events to watch.
     * @param cb supplies the callback to invoke when a change occurs.
     */
    virtual void addWatch(const std::string& path, uint32_t events, OnChangedCb cb) PURE;
  };
  
  typedef std::unique_ptr<Watcher> WatcherPtr;
  
  } // namespace Filesystem
  } // namespace Envoy
  