diff --git a/cloud/aws/aws_file_system.cc b/cloud/aws/aws_file_system.cc index dec52b9a506..b8d98806d92 100644 --- a/cloud/aws/aws_file_system.cc +++ b/cloud/aws/aws_file_system.cc @@ -12,7 +12,7 @@ #include "cloud/cloud_log_controller_impl.h" #include "cloud/cloud_scheduler.h" -#include "cloud/cloud_storage_provider_impl.h" +#include "rocksdb/cloud/cloud_storage_provider_impl.h" #include "cloud/filename.h" #include "port/port.h" #include "rocksdb/cloud/cloud_log_controller.h" diff --git a/cloud/aws/aws_file_system.h b/cloud/aws/aws_file_system.h index 6f3afa5c7b7..99263f9f985 100644 --- a/cloud/aws/aws_file_system.h +++ b/cloud/aws/aws_file_system.h @@ -8,7 +8,7 @@ #include #include -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #ifdef USE_AWS diff --git a/cloud/aws/aws_s3.cc b/cloud/aws/aws_s3.cc index dc1511fca50..cc9916e7d3d 100644 --- a/cloud/aws/aws_s3.cc +++ b/cloud/aws/aws_s3.cc @@ -43,7 +43,7 @@ #include "cloud/aws/aws_file.h" #include "cloud/aws/aws_file_system.h" -#include "cloud/cloud_storage_provider_impl.h" +#include "rocksdb/cloud/cloud_storage_provider_impl.h" #include "cloud/filename.h" #include "file/read_write_util.h" #include "file/writable_file_writer.h" diff --git a/cloud/cloud_file_deletion_scheduler.cc b/cloud/cloud_file_deletion_scheduler.cc index 3c30a5376a2..2eedd7b1ef0 100644 --- a/cloud/cloud_file_deletion_scheduler.cc +++ b/cloud/cloud_file_deletion_scheduler.cc @@ -1,6 +1,6 @@ // Copyright (c) 2016-present, Rockset, Inc. All rights reserved. -#include "cloud/cloud_file_deletion_scheduler.h" +#include "rocksdb/cloud/cloud_file_deletion_scheduler.h" #include "cloud/cloud_scheduler.h" #include "test_util/sync_point.h" diff --git a/cloud/cloud_file_system.cc b/cloud/cloud_file_system.cc index 6c859532168..8d659931e0f 100644 --- a/cloud/cloud_file_system.cc +++ b/cloud/cloud_file_system.cc @@ -11,9 +11,9 @@ #include #include "cloud/aws/aws_file_system.h" -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include "cloud/cloud_log_controller_impl.h" -#include "cloud/cloud_storage_provider_impl.h" +#include "rocksdb/cloud/cloud_storage_provider_impl.h" #include "cloud/db_cloud_impl.h" #include "cloud/filename.h" #include "env/composite_env_wrapper.h" diff --git a/cloud/cloud_file_system_impl.cc b/cloud/cloud_file_system_impl.cc index e9465b3c4ad..259dd2ef17c 100644 --- a/cloud/cloud_file_system_impl.cc +++ b/cloud/cloud_file_system_impl.cc @@ -1,11 +1,11 @@ // Copyright (c) 2017 Rockset. #ifndef ROCKSDB_LITE -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include -#include "cloud/cloud_file_deletion_scheduler.h" +#include "rocksdb/cloud/cloud_file_deletion_scheduler.h" #include "cloud/cloud_log_controller_impl.h" #include "cloud/cloud_manifest.h" #include "cloud/cloud_scheduler.h" @@ -17,6 +17,7 @@ #include "file/filename.h" #include "file/writable_file_writer.h" #include "port/likely.h" +#include "port/port_posix.h" #include "rocksdb/cloud/cloud_log_controller.h" #include "rocksdb/cloud/cloud_storage_provider.h" #include "rocksdb/db.h" diff --git a/cloud/cloud_file_system_test.cc b/cloud/cloud_file_system_test.cc index e8e6dc6febf..59032aab352 100644 --- a/cloud/cloud_file_system_test.cc +++ b/cloud/cloud_file_system_test.cc @@ -3,7 +3,7 @@ #include "rocksdb/cloud/cloud_file_system.h" #include "cloud/cloud_log_controller_impl.h" -#include "cloud/cloud_storage_provider_impl.h" +#include "rocksdb/cloud/cloud_storage_provider_impl.h" #include "rocksdb/cloud/cloud_log_controller.h" #include "rocksdb/cloud/cloud_storage_provider.h" #include "rocksdb/convenience.h" diff --git a/cloud/cloud_storage_provider.cc b/cloud/cloud_storage_provider.cc index 4e6f88454f8..f1c798ff1eb 100644 --- a/cloud/cloud_storage_provider.cc +++ b/cloud/cloud_storage_provider.cc @@ -7,8 +7,8 @@ #include #include -#include "cloud/cloud_file_system_impl.h" -#include "cloud/cloud_storage_provider_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_storage_provider_impl.h" #include "cloud/filename.h" #include "file/filename.h" #include "rocksdb/cloud/cloud_file_system.h" @@ -18,6 +18,7 @@ #include "rocksdb/status.h" #include "rocksdb/utilities/object_registry.h" #include "util/coding.h" +#include "util/random.h" #include "util/string_util.h" namespace ROCKSDB_NAMESPACE { @@ -287,7 +288,7 @@ Status CloudStorageProviderImpl::PrepareOptions(const ConfigOptions& options) { return st; } -CloudStorageProviderImpl::CloudStorageProviderImpl() : rng_(time(nullptr)) {} +CloudStorageProviderImpl::CloudStorageProviderImpl() : rng_(make_unique(time(nullptr))) {} CloudStorageProviderImpl::~CloudStorageProviderImpl() {} @@ -310,7 +311,7 @@ IOStatus CloudStorageProviderImpl::GetCloudObject( const std::string& local_destination) { const auto& local_fs = cfs_->GetBaseFileSystem(); std::string tmp_destination = - local_destination + ".tmp-" + std::to_string(rng_.Next()); + local_destination + ".tmp-" + std::to_string(rng_->Next()); uint64_t remote_size; auto s = DoGetCloudObject(bucket_name, object_path, tmp_destination, diff --git a/cloud/db_cloud_impl.cc b/cloud/db_cloud_impl.cc index 2d4448a487f..424cd45ea0f 100644 --- a/cloud/db_cloud_impl.cc +++ b/cloud/db_cloud_impl.cc @@ -5,7 +5,7 @@ #include -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include "cloud/filename.h" #include "cloud/manifest_reader.h" #include "env/composite_env_wrapper.h" diff --git a/cloud/db_cloud_test.cc b/cloud/db_cloud_test.cc index e5f13018c4b..75fd5363d70 100644 --- a/cloud/db_cloud_test.cc +++ b/cloud/db_cloud_test.cc @@ -14,10 +14,10 @@ #include #include -#include "cloud/cloud_file_deletion_scheduler.h" -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_deletion_scheduler.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include "cloud/cloud_scheduler.h" -#include "cloud/cloud_storage_provider_impl.h" +#include "rocksdb/cloud/cloud_storage_provider_impl.h" #include "cloud/db_cloud_impl.h" #include "cloud/filename.h" #include "cloud/manifest_reader.h" diff --git a/cloud/manifest_reader.cc b/cloud/manifest_reader.cc index e916bed6a2d..0b8a8e40547 100644 --- a/cloud/manifest_reader.cc +++ b/cloud/manifest_reader.cc @@ -5,9 +5,9 @@ #include -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include "cloud/cloud_manifest.h" -#include "cloud/cloud_storage_provider_impl.h" +#include "rocksdb/cloud/cloud_storage_provider_impl.h" #include "cloud/db_cloud_impl.h" #include "cloud/filename.h" #include "db/version_set.h" diff --git a/cloud/purge.cc b/cloud/purge.cc index 8ee7628a758..6cd4f5fc5af 100644 --- a/cloud/purge.cc +++ b/cloud/purge.cc @@ -6,7 +6,7 @@ #include #include -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include "cloud/db_cloud_impl.h" #include "cloud/filename.h" #include "cloud/manifest_reader.h" diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 9d76bbb91dd..149768efb6c 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -19,7 +19,7 @@ #include "util/stderr_logger.h" #ifdef USE_AWS #include -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include "rocksdb/cloud/cloud_storage_provider.h" #endif #include "rocksdb/unique_id.h" diff --git a/cloud/cloud_file_deletion_scheduler.h b/include/rocksdb/cloud/cloud_file_deletion_scheduler.h similarity index 95% rename from cloud/cloud_file_deletion_scheduler.h rename to include/rocksdb/cloud/cloud_file_deletion_scheduler.h index 5e74b759ec5..fb7bb3ad86d 100644 --- a/cloud/cloud_file_deletion_scheduler.h +++ b/include/rocksdb/cloud/cloud_file_deletion_scheduler.h @@ -2,7 +2,11 @@ #pragma once #include -#include "util/mutexlock.h" +#include +#include +#include +#include +#include "rocksdb/status.h" namespace ROCKSDB_NAMESPACE { class CloudScheduler; diff --git a/cloud/cloud_file_system_impl.h b/include/rocksdb/cloud/cloud_file_system_impl.h similarity index 99% rename from cloud/cloud_file_system_impl.h rename to include/rocksdb/cloud/cloud_file_system_impl.h index 83a2be8b36d..23d2873af9c 100644 --- a/cloud/cloud_file_system_impl.h +++ b/include/rocksdb/cloud/cloud_file_system_impl.h @@ -7,15 +7,13 @@ #include #include -#include "cloud/cloud_manifest.h" -#include "port/port_posix.h" #include "rocksdb/cloud/cloud_file_system.h" #include "rocksdb/file_system.h" #include "rocksdb/io_status.h" #include "rocksdb/status.h" -#include "util/mutexlock.h" namespace ROCKSDB_NAMESPACE { +class CloudManifest; class CloudScheduler; class CloudStorageReadableFile; class ObjectLibrary; diff --git a/cloud/cloud_file_system_wrapper.h b/include/rocksdb/cloud/cloud_file_system_wrapper.h similarity index 99% rename from cloud/cloud_file_system_wrapper.h rename to include/rocksdb/cloud/cloud_file_system_wrapper.h index a7a7759818f..a7e17646ba9 100644 --- a/cloud/cloud_file_system_wrapper.h +++ b/include/rocksdb/cloud/cloud_file_system_wrapper.h @@ -4,7 +4,7 @@ #include #include -#include "cloud/cloud_file_system_impl.h" +#include "rocksdb/cloud/cloud_file_system_impl.h" #include "rocksdb/cloud/cloud_file_system.h" #include "rocksdb/cloud/cloud_storage_provider.h" #include "rocksdb/status.h" diff --git a/cloud/cloud_storage_provider_impl.h b/include/rocksdb/cloud/cloud_storage_provider_impl.h similarity index 99% rename from cloud/cloud_storage_provider_impl.h rename to include/rocksdb/cloud/cloud_storage_provider_impl.h index bc04904b02b..ee2f39e4a5a 100644 --- a/cloud/cloud_storage_provider_impl.h +++ b/include/rocksdb/cloud/cloud_storage_provider_impl.h @@ -4,7 +4,6 @@ #ifndef ROCKSDB_LITE #include "rocksdb/cloud/cloud_storage_provider.h" -#include "util/random.h" #include namespace ROCKSDB_NAMESPACE { @@ -115,6 +114,7 @@ class CloudStorageWritableFileImpl : public CloudStorageWritableFile { // All writes to this DB can be configured to be persisted // in cloud storage. // +class Random64; class CloudStorageProviderImpl : public CloudStorageProvider { public: static Status CreateS3Provider(std::unique_ptr* result); @@ -136,7 +136,7 @@ class CloudStorageProviderImpl : public CloudStorageProvider { Status PrepareOptions(const ConfigOptions& options) override; protected: - Random64 rng_; + unique_ptr rng_; virtual IOStatus DoNewCloudReadableFile( const std::string& bucket, const std::string& fname, uint64_t fsize, const std::string& content_hash, const FileOptions& options,