env_timed.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Copyright (c) 2019-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. //
  6. #pragma once
  7. #include "rocksdb/file_system.h"
  8. namespace ROCKSDB_NAMESPACE {
  9. class TimedFileSystem : public FileSystemWrapper {
  10. public:
  11. explicit TimedFileSystem(const std::shared_ptr<FileSystem>& base);
  12. static const char* kClassName() { return "TimedFS"; }
  13. const char* Name() const override { return kClassName(); }
  14. IOStatus NewSequentialFile(const std::string& fname,
  15. const FileOptions& options,
  16. std::unique_ptr<FSSequentialFile>* result,
  17. IODebugContext* dbg) override;
  18. IOStatus NewRandomAccessFile(const std::string& fname,
  19. const FileOptions& options,
  20. std::unique_ptr<FSRandomAccessFile>* result,
  21. IODebugContext* dbg) override;
  22. IOStatus NewWritableFile(const std::string& fname, const FileOptions& options,
  23. std::unique_ptr<FSWritableFile>* result,
  24. IODebugContext* dbg) override;
  25. IOStatus ReuseWritableFile(const std::string& fname,
  26. const std::string& old_fname,
  27. const FileOptions& options,
  28. std::unique_ptr<FSWritableFile>* result,
  29. IODebugContext* dbg) override;
  30. IOStatus NewRandomRWFile(const std::string& fname, const FileOptions& options,
  31. std::unique_ptr<FSRandomRWFile>* result,
  32. IODebugContext* dbg) override;
  33. IOStatus NewDirectory(const std::string& name, const IOOptions& options,
  34. std::unique_ptr<FSDirectory>* result,
  35. IODebugContext* dbg) override;
  36. IOStatus FileExists(const std::string& fname, const IOOptions& options,
  37. IODebugContext* dbg) override;
  38. IOStatus GetChildren(const std::string& dir, const IOOptions& options,
  39. std::vector<std::string>* result,
  40. IODebugContext* dbg) override;
  41. IOStatus GetChildrenFileAttributes(const std::string& dir,
  42. const IOOptions& options,
  43. std::vector<FileAttributes>* result,
  44. IODebugContext* dbg) override;
  45. IOStatus DeleteFile(const std::string& fname, const IOOptions& options,
  46. IODebugContext* dbg) override;
  47. IOStatus CreateDir(const std::string& dirname, const IOOptions& options,
  48. IODebugContext* dbg) override;
  49. IOStatus CreateDirIfMissing(const std::string& dirname,
  50. const IOOptions& options,
  51. IODebugContext* dbg) override;
  52. IOStatus DeleteDir(const std::string& dirname, const IOOptions& options,
  53. IODebugContext* dbg) override;
  54. IOStatus GetFileSize(const std::string& fname, const IOOptions& options,
  55. uint64_t* file_size, IODebugContext* dbg) override;
  56. IOStatus GetFileModificationTime(const std::string& fname,
  57. const IOOptions& options,
  58. uint64_t* file_mtime,
  59. IODebugContext* dbg) override;
  60. IOStatus RenameFile(const std::string& src, const std::string& dst,
  61. const IOOptions& options, IODebugContext* dbg) override;
  62. IOStatus LinkFile(const std::string& src, const std::string& dst,
  63. const IOOptions& options, IODebugContext* dbg) override;
  64. IOStatus LockFile(const std::string& fname, const IOOptions& options,
  65. FileLock** lock, IODebugContext* dbg) override;
  66. IOStatus UnlockFile(FileLock* lock, const IOOptions& options,
  67. IODebugContext* dbg) override;
  68. IOStatus NewLogger(const std::string& fname, const IOOptions& options,
  69. std::shared_ptr<Logger>* result,
  70. IODebugContext* dbg) override;
  71. };
  72. } // namespace ROCKSDB_NAMESPACE