Skip to content

Commit f49a422

Browse files
committed
revert .clang-format changes
1 parent 0e058a5 commit f49a422

File tree

1 file changed

+97
-96
lines changed

1 file changed

+97
-96
lines changed

include/rocksdb/cloud/cloud_file_system.h

Lines changed: 97 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
// Copyright (c) 2016-present, Rockset, Inc. All rights reserved.
22
//
33
#pragma once
4-
#include "rocksdb/cache.h"
5-
#include "rocksdb/configurable.h"
6-
#include "rocksdb/file_system.h"
7-
#include "rocksdb/io_status.h"
8-
#include "rocksdb/status.h"
94
#include <chrono>
105
#include <functional>
116
#include <memory>
127
#include <optional>
138
#include <string>
149
#include <unordered_map>
1510

11+
#include "rocksdb/cache.h"
12+
#include "rocksdb/configurable.h"
13+
#include "rocksdb/file_system.h"
14+
#include "rocksdb/io_status.h"
15+
#include "rocksdb/status.h"
16+
1617
namespace Aws {
1718
namespace Auth {
1819
class AWSCredentialsProvider;
@@ -89,10 +90,10 @@ class AwsCloudAccessCredentials {
8990
// functions to support AWS credentials
9091
//
9192
// Initialize AWS credentials using access_key_id and secret_key
92-
void InitializeSimple(std::string const& aws_access_key_id,
93-
std::string const& aws_secret_key);
93+
void InitializeSimple(const std::string& aws_access_key_id,
94+
const std::string& aws_secret_key);
9495
// Initialize AWS credentials using a config file
95-
void InitializeConfig(std::string const& aws_config_file);
96+
void InitializeConfig(const std::string& aws_config_file);
9697

9798
// test if valid AWS credentials are present
9899
Status HasValid() const;
@@ -103,7 +104,7 @@ class AwsCloudAccessCredentials {
103104

104105
private:
105106
AwsAccessType GetAccessType() const;
106-
Status CheckCredentials(AwsAccessType const& aws_type) const;
107+
Status CheckCredentials(const AwsAccessType& aws_type) const;
107108

108109
public:
109110
std::string access_key_id;
@@ -116,13 +117,13 @@ class AwsCloudAccessCredentials {
116117
};
117118

118119
using S3ClientFactory = std::function<std::shared_ptr<Aws::S3::S3Client>(
119-
std::shared_ptr<Aws::Auth::AWSCredentialsProvider> const&,
120-
Aws::Client::ClientConfiguration const&)>;
120+
const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>&,
121+
const Aws::Client::ClientConfiguration&)>;
121122

122123
#ifdef USE_GCP
123124
using GCSClientFactory =
124125
std::function<std::shared_ptr<google::cloud::storage::Client>(
125-
google::cloud::Options const&)>;
126+
const google::cloud::Options&)>;
126127
#endif
127128

128129
// Defines parameters required to connect to Kafka
@@ -161,24 +162,24 @@ class BucketOptions {
161162
// Sets the name of the bucket to be the new bucket name.
162163
// If prefix is specified, the new bucket name will be [prefix][bucket]
163164
// If no prefix is specified, the bucket name will use the existing prefix
164-
void SetBucketName(std::string const& bucket, std::string const& prefix = "");
165-
std::string const& GetBucketPrefix() const { return prefix_; }
166-
std::string const& GetBucketName(bool full = true) const {
165+
void SetBucketName(const std::string& bucket, const std::string& prefix = "");
166+
const std::string& GetBucketPrefix() const { return prefix_; }
167+
const std::string& GetBucketName(bool full = true) const {
167168
if (full) {
168169
return name_;
169170
} else {
170171
return bucket_;
171172
}
172173
}
173-
std::string const& GetObjectPath() const { return object_; }
174-
void SetObjectPath(std::string const& object) { object_ = object; }
175-
std::string const& GetRegion() const { return region_; }
176-
void SetRegion(std::string const& region) { region_ = region; }
174+
const std::string& GetObjectPath() const { return object_; }
175+
void SetObjectPath(const std::string& object) { object_ = object; }
176+
const std::string& GetRegion() const { return region_; }
177+
void SetRegion(const std::string& region) { region_ = region; }
177178

178179
// Initializes the bucket properties for test purposes
179-
void TEST_Initialize(std::string const& name_prefix,
180-
std::string const& object_path,
181-
std::string const& region = "");
180+
void TEST_Initialize(const std::string& name_prefix,
181+
const std::string& object_path,
182+
const std::string& region = "");
182183
bool IsValid() const {
183184
if (object_.empty() || name_.empty()) {
184185
return false;
@@ -188,7 +189,7 @@ class BucketOptions {
188189
}
189190
};
190191

191-
inline bool operator==(BucketOptions const& lhs, BucketOptions const& rhs) {
192+
inline bool operator==(const BucketOptions& lhs, const BucketOptions& rhs) {
192193
if (lhs.IsValid() && rhs.IsValid()) {
193194
return ((lhs.GetBucketName() == rhs.GetBucketName()) &&
194195
(lhs.GetObjectPath() == rhs.GetObjectPath()) &&
@@ -197,14 +198,14 @@ inline bool operator==(BucketOptions const& lhs, BucketOptions const& rhs) {
197198
return false;
198199
}
199200
}
200-
inline bool operator!=(BucketOptions const& lhs, BucketOptions const& rhs) {
201+
inline bool operator!=(const BucketOptions& lhs, const BucketOptions& rhs) {
201202
return !(lhs == rhs);
202203
}
203204

204205
class AwsCloudOptions {
205206
public:
206207
static Status GetClientConfiguration(
207-
CloudFileSystem* fs, std::string const& region,
208+
CloudFileSystem* fs, const std::string& region,
208209
Aws::Client::ClientConfiguration* config);
209210
};
210211

@@ -215,7 +216,7 @@ class AwsCloudOptions {
215216
class CloudFileSystemOptions {
216217
private:
217218
public:
218-
static char const* kName() { return "CloudFileSystemOptions"; }
219+
static const char* kName() { return "CloudFileSystemOptions"; }
219220
BucketOptions src_bucket;
220221
BucketOptions dest_bucket;
221222
// Specify the type of cloud-service to use. Deprecated.
@@ -492,11 +493,11 @@ class CloudFileSystemOptions {
492493

493494
// Sets result based on the value of name or alt in the environment
494495
// Returns true if the name/alt exists in the environment, false otherwise
495-
static bool GetNameFromEnvironment(char const* name, char const* alt,
496+
static bool GetNameFromEnvironment(const char* name, const char* alt,
496497
std::string* result);
497-
void TEST_Initialize(std::string const& name_prefix,
498-
std::string const& object_path,
499-
std::string const& region = "");
498+
void TEST_Initialize(const std::string& name_prefix,
499+
const std::string& object_path,
500+
const std::string& region = "");
500501

501502
Status Configure(const ConfigOptions& config_options,
502503
const std::string& opts_str);
@@ -542,53 +543,53 @@ class CloudFileSystem : public FileSystem {
542543
// The returned Env must not outlive "this"
543544
std::unique_ptr<Env> NewCompositeEnvFromThis(Env* env);
544545

545-
CloudFileSystem(CloudFileSystemOptions const& options,
546-
std::shared_ptr<FileSystem> const& base,
547-
std::shared_ptr<Logger> const& logger);
546+
CloudFileSystem(const CloudFileSystemOptions& options,
547+
const std::shared_ptr<FileSystem>& base,
548+
const std::shared_ptr<Logger>& logger);
548549

549550
public:
550551
mutable std::shared_ptr<Logger> info_log_; // informational messages
551552

552553
virtual ~CloudFileSystem();
553554

554-
static void RegisterCloudObjects(std::string const& mode = "");
555-
static Status CreateFromString(ConfigOptions const& config_options,
556-
std::string const& id,
555+
static void RegisterCloudObjects(const std::string& mode = "");
556+
static Status CreateFromString(const ConfigOptions& config_options,
557+
const std::string& id,
557558
std::unique_ptr<CloudFileSystem>* fs);
558-
static Status CreateFromString(ConfigOptions const& config_options,
559-
std::string const& id,
560-
CloudFileSystemOptions const& cloud_options,
559+
static Status CreateFromString(const ConfigOptions& config_options,
560+
const std::string& id,
561+
const CloudFileSystemOptions& cloud_options,
561562
std::unique_ptr<CloudFileSystem>* fs);
562-
static char const* kCloud() { return "cloud"; }
563-
static char const* kAws() { return "aws"; }
564-
static char const* kGcp() { return "gcp"; }
565-
virtual char const* Name() const { return "cloud-env"; }
563+
static const char* kCloud() { return "cloud"; }
564+
static const char* kAws() { return "aws"; }
565+
static const char* kGcp() { return "gcp"; }
566+
virtual const char* Name() const { return "cloud-env"; }
566567
// Returns the underlying file system
567-
std::shared_ptr<FileSystem> const& GetBaseFileSystem() const {
568+
const std::shared_ptr<FileSystem>& GetBaseFileSystem() const {
568569
return base_fs_;
569570
}
570-
virtual IOStatus PreloadCloudManifest(std::string const& local_dbname) = 0;
571+
virtual IOStatus PreloadCloudManifest(const std::string& local_dbname) = 0;
571572
// This method will migrate the database that is using pure RocksDB into
572573
// RocksDB-Cloud. Call this before opening the database with RocksDB-Cloud.
573-
virtual IOStatus MigrateFromPureRocksDB(std::string const& local_dbname) = 0;
574+
virtual IOStatus MigrateFromPureRocksDB(const std::string& local_dbname) = 0;
574575

575576
// Reads a file from the cloud
576577
virtual IOStatus NewSequentialFileCloud(
577-
std::string const& bucket_prefix, std::string const& fname,
578-
FileOptions const& file_opts, std::unique_ptr<FSSequentialFile>* result,
578+
const std::string& bucket_prefix, const std::string& fname,
579+
const FileOptions& file_opts, std::unique_ptr<FSSequentialFile>* result,
579580
IODebugContext* dbg) = 0;
580581

581582
// Saves and retrieves the dbid->dirname mapping in cloud storage
582-
virtual IOStatus SaveDbid(std::string const& bucket_name,
583-
std::string const& dbid,
584-
std::string const& dirname) = 0;
585-
virtual IOStatus GetPathForDbid(std::string const& bucket_prefix,
586-
std::string const& dbid,
583+
virtual IOStatus SaveDbid(const std::string& bucket_name,
584+
const std::string& dbid,
585+
const std::string& dirname) = 0;
586+
virtual IOStatus GetPathForDbid(const std::string& bucket_prefix,
587+
const std::string& dbid,
587588
std::string* dirname) = 0;
588-
virtual IOStatus GetDbidList(std::string const& bucket_prefix,
589+
virtual IOStatus GetDbidList(const std::string& bucket_prefix,
589590
DbidList* dblist) = 0;
590-
virtual IOStatus DeleteDbid(std::string const& bucket_prefix,
591-
std::string const& dbid) = 0;
591+
virtual IOStatus DeleteDbid(const std::string& bucket_prefix,
592+
const std::string& dbid) = 0;
592593

593594
Logger* GetLogger() const { return info_log_.get(); }
594595
const std::shared_ptr<CloudStorageProvider>& GetStorageProvider() const {
@@ -603,10 +604,10 @@ class CloudFileSystem : public FileSystem {
603604
// GetSrcObjectPath specifies the path inside that bucket
604605
// where data files reside. The specified bucket is used in
605606
// a readonly mode by the associated DBCloud instance.
606-
std::string const& GetSrcBucketName() const {
607+
const std::string& GetSrcBucketName() const {
607608
return cloud_fs_options.src_bucket.GetBucketName();
608609
}
609-
std::string const& GetSrcObjectPath() const {
610+
const std::string& GetSrcObjectPath() const {
610611
return cloud_fs_options.src_bucket.GetObjectPath();
611612
}
612613
bool HasSrcBucket() const { return cloud_fs_options.src_bucket.IsValid(); }
@@ -615,10 +616,10 @@ class CloudFileSystem : public FileSystem {
615616
// GetDestObjectPath specifies the path inside that bucket
616617
// where data files reside. The associated DBCloud instance
617618
// writes newly created files to this bucket.
618-
std::string const& GetDestBucketName() const {
619+
const std::string& GetDestBucketName() const {
619620
return cloud_fs_options.dest_bucket.GetBucketName();
620621
}
621-
std::string const& GetDestObjectPath() const {
622+
const std::string& GetDestObjectPath() const {
622623
return cloud_fs_options.dest_bucket.GetObjectPath();
623624
}
624625

@@ -632,29 +633,29 @@ class CloudFileSystem : public FileSystem {
632633
}
633634

634635
// returns the options used to create this object
635-
CloudFileSystemOptions const& GetCloudFileSystemOptions() const {
636+
const CloudFileSystemOptions& GetCloudFileSystemOptions() const {
636637
return cloud_fs_options;
637638
}
638639

639640
// Deletes file from a destination bucket.
640-
virtual IOStatus DeleteCloudFileFromDest(std::string const& fname) = 0;
641+
virtual IOStatus DeleteCloudFileFromDest(const std::string& fname) = 0;
641642
// Copies a local file to a destination bucket.
642-
virtual IOStatus CopyLocalFileToDest(std::string const& local_name,
643-
std::string const& cloud_name) = 0;
643+
virtual IOStatus CopyLocalFileToDest(const std::string& local_name,
644+
const std::string& cloud_name) = 0;
644645

645646
// Transfers the filename from RocksDB's domain to the physical domain, based
646647
// on information stored in CLOUDMANIFEST.
647648
// For example, it will map 00010.sst to 00010.sst-[epoch] where [epoch] is
648649
// an epoch during which that file was created.
649650
// Files both in S3 and in the local directory have this [epoch] suffix.
650-
virtual std::string RemapFilename(std::string const& logical_name) const = 0;
651+
virtual std::string RemapFilename(const std::string& logical_name) const = 0;
651652

652653
// Find the list of live files based on CloudManifest and Manifest in local db
653654
//
654655
// For the returned filepath in `live_sst_files` and `manifest_file`, we only
655656
// include the basename of the filepath but not the directory prefix to the
656657
// file
657-
virtual IOStatus FindAllLiveFiles(std::string const& local_dbname,
658+
virtual IOStatus FindAllLiveFiles(const std::string& local_dbname,
658659
std::vector<std::string>* live_sst_files,
659660
std::string* manifest_file) = 0;
660661

@@ -673,7 +674,7 @@ class CloudFileSystem : public FileSystem {
673674
//
674675
// If delta has already been applied in cloud manifest, delta_applied would be
675676
// `false`
676-
virtual IOStatus ApplyCloudManifestDelta(CloudManifestDelta const& delta,
677+
virtual IOStatus ApplyCloudManifestDelta(const CloudManifestDelta& delta,
677678
bool* delta_applied) = 0;
678679

679680
// This function does several things:
@@ -685,15 +686,15 @@ class CloudFileSystem : public FileSystem {
685686
//
686687
// Return InvalidArgument status if the delta has been applied in current
687688
// CloudManifest
688-
virtual IOStatus RollNewCookie(std::string const& local_dbname,
689-
std::string const& cookie,
690-
CloudManifestDelta const& delta) const = 0;
689+
virtual IOStatus RollNewCookie(const std::string& local_dbname,
690+
const std::string& cookie,
691+
const CloudManifestDelta& delta) const = 0;
691692

692693
virtual IOStatus GetMaxFileNumberFromCurrentManifest(
693-
std::string const& local_dbname, uint64_t* max_file_number) = 0;
694+
const std::string& local_dbname, uint64_t* max_file_number) = 0;
694695

695696
virtual IOStatus DeleteCloudInvisibleFiles(
696-
std::vector<std::string> const& active_cookies) = 0;
697+
const std::vector<std::string>& active_cookies) = 0;
697698

698699
// Create a new AWS file system.
699700
// src_bucket_name: bucket name suffix where db data is read from
@@ -706,34 +707,34 @@ class CloudFileSystem : public FileSystem {
706707
// data from cloud storage.
707708
// If dest_bucket_name is empty, then the associated db does not write any
708709
// data to cloud storage.
709-
static Status NewAwsFileSystem(std::shared_ptr<FileSystem> const& base_fs,
710-
std::string const& src_bucket_name,
711-
std::string const& src_object_prefix,
712-
std::string const& src_bucket_region,
713-
std::string const& dest_bucket_name,
714-
std::string const& dest_object_prefix,
715-
std::string const& dest_bucket_region,
716-
CloudFileSystemOptions const& fs_options,
717-
std::shared_ptr<Logger> const& logger,
710+
static Status NewAwsFileSystem(const std::shared_ptr<FileSystem>& base_fs,
711+
const std::string& src_bucket_name,
712+
const std::string& src_object_prefix,
713+
const std::string& src_bucket_region,
714+
const std::string& dest_bucket_name,
715+
const std::string& dest_object_prefix,
716+
const std::string& dest_bucket_region,
717+
const CloudFileSystemOptions& fs_options,
718+
const std::shared_ptr<Logger>& logger,
718719
CloudFileSystem** cfs);
719-
static Status NewAwsFileSystem(std::shared_ptr<FileSystem> const& base_fs,
720-
CloudFileSystemOptions const& fs_options,
721-
std::shared_ptr<Logger> const& logger,
720+
static Status NewAwsFileSystem(const std::shared_ptr<FileSystem>& base_fs,
721+
const CloudFileSystemOptions& fs_options,
722+
const std::shared_ptr<Logger>& logger,
722723
CloudFileSystem** cfs);
723724

724-
static Status NewGcpFileSystem(std::shared_ptr<FileSystem> const& base_fs,
725-
std::string const& src_bucket_name,
726-
std::string const& src_object_prefix,
727-
std::string const& src_buck_region,
728-
std::string const& dest_bucket_name,
729-
std::string const& dest_bucket_prefix,
730-
std::string const& dest_bucket_region,
731-
CloudFileSystemOptions const& fs_options,
732-
std::shared_ptr<Logger> const& logger,
725+
static Status NewGcpFileSystem(const std::shared_ptr<FileSystem>& base_fs,
726+
const std::string& src_bucket_name,
727+
const std::string& src_object_prefix,
728+
const std::string& src_buck_region,
729+
const std::string& dest_bucket_name,
730+
const std::string& dest_bucket_prefix,
731+
const std::string& dest_bucket_region,
732+
const CloudFileSystemOptions& fs_options,
733+
const std::shared_ptr<Logger>& logger,
733734
CloudFileSystem** cfs);
734-
static Status NewGcpFileSystem(std::shared_ptr<FileSystem> const& base_fs,
735-
CloudFileSystemOptions const& fs_options,
736-
std::shared_ptr<Logger> const& logger,
735+
static Status NewGcpFileSystem(const std::shared_ptr<FileSystem>& base_fs,
736+
const CloudFileSystemOptions& fs_options,
737+
const std::shared_ptr<Logger>& logger,
737738
CloudFileSystem** cfs);
738739

739740
// Creates a new Env that delegates all thread/time related

0 commit comments

Comments
 (0)