From bee356456411ffe8f327a0afb428fac8ca3ffaaf Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 1 Dec 2025 11:47:09 +0300 Subject: [PATCH] sstable: Shuffle args for s3_client_wrapper Make it construct like gs_client_wrapper -- with generic endpoint param reference and make the storage-specific casts/gets/whatever internally. Signed-off-by: Pavel Emelyanov --- sstables/object_storage_client.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sstables/object_storage_client.cc b/sstables/object_storage_client.cc index c4adb092ec..fcf8d4f383 100644 --- a/sstables/object_storage_client.cc +++ b/sstables/object_storage_client.cc @@ -60,12 +60,18 @@ fmt::formatter::format(const sstables::object_name& n, fm return fmt::format_to(ctx.out(), "{}", n.str()); } +static shared_ptr make_s3_client(const db::object_storage_endpoint_param& ep, semaphore& memory, std::function(std::string)> factory) { + auto& epc = ep.get_s3_storage(); + auto cfg = make_lw_shared(ep.get_s3_storage().config); + return s3::client::make(epc.endpoint, std::move(cfg), memory, std::move(factory)); +} + class s3_client_wrapper : public sstables::object_storage_client { shared_ptr _client; shard_client_factory _cf; public: - s3_client_wrapper(const std::string& host, s3::endpoint_config_ptr cfg, semaphore& memory, shard_client_factory cf) - : _client(s3::client::make(host, cfg, memory, std::bind_front(&s3_client_wrapper::shard_client, this))) + s3_client_wrapper(const db::object_storage_endpoint_param& ep, semaphore& memory, shard_client_factory cf) + : _client(make_s3_client(ep, memory, std::bind_front(&s3_client_wrapper::shard_client, this))) , _cf(std::move(cf)) {} shared_ptr shard_client(std::string host) const { @@ -290,9 +296,7 @@ public: shared_ptr sstables::make_object_storage_client(const db::object_storage_endpoint_param& ep, semaphore& memory, shard_client_factory cf) { if (ep.is_s3_storage()) { - auto& epc = ep.get_s3_storage(); - auto s3_cfg = make_lw_shared(epc.config); - return seastar::make_shared(epc.endpoint, std::move(s3_cfg), memory, std::move(cf)); + return seastar::make_shared(ep, memory, std::move(cf)); } if (ep.is_gs_storage()) { return seastar::make_shared(ep, memory, std::move(cf));