file_util.h 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2011-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 <string>
  8. #include "file/filename.h"
  9. #include "options/db_options.h"
  10. #include "rocksdb/env.h"
  11. #include "rocksdb/file_system.h"
  12. #include "rocksdb/status.h"
  13. #include "rocksdb/types.h"
  14. namespace ROCKSDB_NAMESPACE {
  15. // use_fsync maps to options.use_fsync, which determines the way that
  16. // the file is synced after copying.
  17. extern Status CopyFile(FileSystem* fs, const std::string& source,
  18. const std::string& destination, uint64_t size,
  19. bool use_fsync);
  20. extern Status CreateFile(FileSystem* fs, const std::string& destination,
  21. const std::string& contents, bool use_fsync);
  22. extern Status DeleteDBFile(const ImmutableDBOptions* db_options,
  23. const std::string& fname,
  24. const std::string& path_to_sync, const bool force_bg,
  25. const bool force_fg);
  26. extern bool IsWalDirSameAsDBPath(const ImmutableDBOptions* db_options);
  27. } // namespace ROCKSDB_NAMESPACE