]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/file/filename.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / file / filename.h
index 188305a6d5b0714dc2c1cd00986c39d3e5ce4cc0..2eb125b6a178d8d8cf0a73c9c9793832dd747e87 100644 (file)
@@ -11,8 +11,9 @@
 
 #pragma once
 #include <stdint.h>
-#include <unordered_map>
+
 #include <string>
+#include <unordered_map>
 #include <vector>
 
 #include "options/db_options.h"
@@ -27,12 +28,13 @@ namespace ROCKSDB_NAMESPACE {
 
 class Env;
 class Directory;
+class SystemClock;
 class WritableFileWriter;
 
 #ifdef OS_WIN
-const char kFilePathSeparator = '\\';
+constexpr char kFilePathSeparator = '\\';
 #else
-const char kFilePathSeparator = '/';
+constexpr char kFilePathSeparator = '/';
 #endif
 
 // Return the name of the log file with the specified number
@@ -49,14 +51,11 @@ extern std::string BlobFileName(const std::string& bdirname, uint64_t number);
 extern std::string BlobFileName(const std::string& dbname,
                                 const std::string& blob_dir, uint64_t number);
 
-static const std::string ARCHIVAL_DIR = "archive";
-
 extern std::string ArchivalDirectory(const std::string& dbname);
 
 //  Return the name of the archived log file with the specified number
 //  in the db named by "dbname". The result will be prefixed with "dbname".
-extern std::string ArchivedLogFileName(const std::string& dbname,
-                                       uint64_t num);
+extern std::string ArchivedLogFileName(const std::string& dbname, uint64_t num);
 
 extern std::string MakeTableFileName(const std::string& name, uint64_t number);
 
@@ -88,6 +87,10 @@ extern void FormatFileNumber(uint64_t number, uint32_t path_id, char* out_buf,
 extern std::string DescriptorFileName(const std::string& dbname,
                                       uint64_t number);
 
+extern std::string DescriptorFileName(uint64_t number);
+
+extern const std::string kCurrentFileName;  // = "CURRENT"
+
 // Return the name of the current file.  This file contains the name
 // of the current manifest file.  The result will be prefixed with
 // "dbname".
@@ -121,13 +124,14 @@ extern std::string OldInfoLogFileName(const std::string& dbname, uint64_t ts,
                                       const std::string& db_path = "",
                                       const std::string& log_dir = "");
 
-static const std::string kOptionsFileNamePrefix = "OPTIONS-";
-static const std::string kTempFileNameSuffix = "dbtmp";
+extern const std::string kOptionsFileNamePrefix;  // = "OPTIONS-"
+extern const std::string kTempFileNameSuffix;     // = "dbtmp"
 
 // Return a options file name given the "dbname" and file number.
 // Format:  OPTIONS-[number].dbtmp
 extern std::string OptionsFileName(const std::string& dbname,
                                    uint64_t file_num);
+extern std::string OptionsFileName(uint64_t file_num);
 
 // Return a temp options file name given the "dbname" and file number.
 // Format:  OPTIONS-[number]
@@ -136,8 +140,7 @@ extern std::string TempOptionsFileName(const std::string& dbname,
 
 // Return the name to use for a metadatabase. The result will be prefixed with
 // "dbname".
-extern std::string MetaDatabaseName(const std::string& dbname,
-                                    uint64_t number);
+extern std::string MetaDatabaseName(const std::string& dbname, uint64_t number);
 
 // Return the name of the Identity file which stores a unique number for the db
 // that will get regenerated if the db loses all its data and is recreated fresh
@@ -156,24 +159,27 @@ extern bool ParseFileName(const std::string& filename, uint64_t* number,
                           FileType* type, WalFileType* log_type = nullptr);
 
 // Make the CURRENT file point to the descriptor file with the
-// specified number.
+// specified number. On its success and when dir_contains_current_file is not
+// nullptr, the function will fsync the directory containing the CURRENT file
+// when
 extern IOStatus SetCurrentFile(FileSystem* fs, const std::string& dbname,
                                uint64_t descriptor_number,
-                               FSDirectory* directory_to_fsync);
+                               FSDirectory* dir_contains_current_file);
 
 // Make the IDENTITY file for the db
 extern Status SetIdentityFile(Env* env, const std::string& dbname,
                               const std::string& db_id = {});
 
 // Sync manifest file `file`.
-extern IOStatus SyncManifest(Env* env, const ImmutableDBOptions* db_options,
+extern IOStatus SyncManifest(const ImmutableDBOptions* db_options,
                              WritableFileWriter* file);
 
 // Return list of file names of info logs in `file_names`.
 // The list only contains file name. The parent directory name is stored
 // in `parent_dir`.
 // `db_log_dir` should be the one as in options.db_log_dir
-extern Status GetInfoLogFiles(Env* env, const std::string& db_log_dir,
+extern Status GetInfoLogFiles(const std::shared_ptr<FileSystem>& fs,
+                              const std::string& db_log_dir,
                               const std::string& dbname,
                               std::string* parent_dir,
                               std::vector<std::string>* file_names);