9#include <boost/filesystem/operations.hpp> 
   11#include <userver/fs/blocking/open_mode.hpp> 
   13USERVER_NAMESPACE_BEGIN
 
   22class FileDescriptor 
final {
 
   26  static FileDescriptor 
Open(
 
   27      const std::string& path, OpenMode flags,
 
   28      boost::filesystem::perms perms = boost::filesystem::perms::owner_read |
 
   29                                       boost::filesystem::perms::owner_write);
 
   37  static FileDescriptor 
AdoptFd(
int fd) 
noexcept;
 
   39  FileDescriptor() = 
delete;
 
   40  FileDescriptor(FileDescriptor&& other) 
noexcept;
 
   41  FileDescriptor& operator=(FileDescriptor&& other) 
noexcept;
 
   62  void Write(std::string_view contents);
 
   68  std::size_t 
Read(
char* buffer, std::size_t max_size);
 
   72  void Seek(std::size_t offset_in_bytes);
 
   83  explicit FileDescriptor(
int fd);
 
   85  friend class TempFile;