22
33#pragma once
44
5+ #include < rocksdb/slice.h>
6+
57#include < algorithm>
68#include < functional>
79#include < string>
8- #include < cstring>
9-
10- #include < rocksdb/slice.h>
1110
1211//
1312// These are inlined methods to deal with pathnames and filenames.
@@ -81,18 +80,24 @@ inline bool ends_with(std::string const& value, std::string const& ending) {
8180 return std::equal (ending.rbegin (), ending.rend (), value.rbegin ());
8281}
8382
84- inline std::string MakeCloudManifestFile (const std::string& dbname, const std::string& cookie) {
85- return cookie.empty () ? (dbname + " /CLOUDMANIFEST" )
86- : (dbname + " /CLOUDMANIFEST-" + cookie);
83+ inline std::string MakeCloudManifestFile (const std::string& cookie) {
84+ return cookie.empty () ? " CLOUDMANIFEST" : " CLOUDMANIFEST-" + cookie;
85+ }
86+ inline std::string MakeCloudManifestFile (const std::string& dbname,
87+ const std::string& cookie) {
88+ assert (!dbname.empty ());
89+ return dbname + " /" + MakeCloudManifestFile (cookie);
8790}
8891
92+ inline std::string ManifestFileWithEpoch (const std::string& epoch) {
93+ return epoch.empty () ? " MANIFEST" : " MANIFEST-" + epoch;
94+ }
8995inline std::string ManifestFileWithEpoch (const std::string& dbname,
9096 const std::string& epoch) {
91- return epoch .empty () ? (dbname + " /MANIFEST " )
92- : ( dbname + " /MANIFEST- " + epoch);
97+ assert (!dbname .empty ());
98+ return dbname + " /" + ManifestFileWithEpoch ( epoch);
9399}
94100
95-
96101inline std::string RemoveEpoch (const std::string& path) {
97102 auto lastDash = path.rfind (' -' );
98103 if (lastDash == std::string::npos) {
@@ -114,7 +119,7 @@ inline std::string GetCookie(const std::string& cloud_manifest_file_path) {
114119 return " " ;
115120 }
116121
117- return cloud_manifest_fname.substr (firstDash+ 1 );
122+ return cloud_manifest_fname.substr (firstDash + 1 );
118123}
119124
120125// pathaname seperator
0 commit comments