From aa34eb201c6ac3cbc7b40c1d507cd420ccfb6bb1 Mon Sep 17 00:00:00 2001 From: Dmitri Petrov Date: Thu, 21 Dec 2023 23:44:08 +0000 Subject: [PATCH] Use virtual inheritance in FileSystem hierarchy. --- include/rocksdb/cloud/cloud_file_system.h | 2 +- include/rocksdb/cloud/cloud_file_system_impl.h | 3 +-- include/rocksdb/file_system.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/rocksdb/cloud/cloud_file_system.h b/include/rocksdb/cloud/cloud_file_system.h index 42aa07c8aaef..7cae24f4b3e1 100644 --- a/include/rocksdb/cloud/cloud_file_system.h +++ b/include/rocksdb/cloud/cloud_file_system.h @@ -494,7 +494,7 @@ struct CloudManifestDelta { // NOTE: The AWS SDK must be initialized before the CloudFileSystem is // constructed, and remain active (Aws::ShutdownAPI() not called) as long as any // CloudFileSystem objects exist. -class CloudFileSystem : public FileSystem { +class CloudFileSystem : public virtual FileSystem { protected: CloudFileSystemOptions cloud_fs_options; std::shared_ptr base_fs_; // The underlying file system diff --git a/include/rocksdb/cloud/cloud_file_system_impl.h b/include/rocksdb/cloud/cloud_file_system_impl.h index dcd9ffc44522..6eada2608559 100644 --- a/include/rocksdb/cloud/cloud_file_system_impl.h +++ b/include/rocksdb/cloud/cloud_file_system_impl.h @@ -22,7 +22,7 @@ class CloudFileDeletionScheduler; // // The Cloud file system // -class CloudFileSystemImpl : public CloudFileSystem { +class CloudFileSystemImpl : public virtual CloudFileSystem { friend class CloudFileSystem; public: @@ -236,7 +236,6 @@ class CloudFileSystemImpl : public CloudFileSystem { "CloudFileSystemImpl::IsDirectory() not supported."); } - IOStatus Poll(std::vector& io_handles, size_t /*min_completions*/) override { for (auto* handle : io_handles) { diff --git a/include/rocksdb/file_system.h b/include/rocksdb/file_system.h index 05ac40b41a89..22e07bb3536b 100644 --- a/include/rocksdb/file_system.h +++ b/include/rocksdb/file_system.h @@ -1380,7 +1380,7 @@ class FSDirectory { // An implementation of Env that forwards all calls to another Env. // May be useful to clients who wish to override just part of the // functionality of another Env. -class FileSystemWrapper : public FileSystem { +class FileSystemWrapper : public virtual FileSystem { public: // Initialize an EnvWrapper that delegates all calls to *t explicit FileSystemWrapper(const std::shared_ptr& t);