]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/cache: removing interface related to Partition.
authorPritha Srivastava <prsrivas@redhat.com>
Tue, 12 Dec 2023 04:01:28 +0000 (09:31 +0530)
committerPritha Srivastava <prsrivas@redhat.com>
Tue, 2 Apr 2024 15:54:51 +0000 (21:24 +0530)
Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
src/rgw/rgw_redis_driver.cc
src/rgw/rgw_redis_driver.h
src/rgw/rgw_ssd_driver.cc
src/rgw/rgw_ssd_driver.h

index f981e74502d56c6421886d553e2123c9021020dd..fb2d6bcd9873ca4dac11f20718a8af4bbdecfd87 100644 (file)
@@ -7,8 +7,6 @@
 
 namespace rgw { namespace cache {
 
-std::unordered_map<std::string, Partition> RedisDriver::partitions;
-
 std::list<std::string> build_attrs(rgw::sal::Attrs* binary) 
 {
   std::list<std::string> values;
@@ -61,41 +59,6 @@ void redis_exec(std::shared_ptr<connection> conn, boost::system::error_code& ec,
   }
 }
 
-int RedisDriver::add_partition_info(Partition& info)
-{
-  std::string key = info.name + info.type;
-  auto ret = partitions.emplace(key, info);
-
-  return ret.second;
-}
-
-int RedisDriver::remove_partition_info(Partition& info)
-{
-  std::string key = info.name + info.type;
-  return partitions.erase(key);
-}
-
-std::optional<Partition> RedisDriver::get_partition_info(const DoutPrefixProvider* dpp, const std::string& name, const std::string& type)
-{
-  std::string key = name + type;
-
-  auto iter = partitions.find(key);
-  if (iter != partitions.end())
-    return iter->second;
-
-  return std::nullopt;
-}
-
-std::vector<Partition> RedisDriver::list_partitions(const DoutPrefixProvider* dpp)
-{
-  std::vector<Partition> partitions_v;
-
-  for (auto& it : partitions)
-    partitions_v.emplace_back(it.second);
-
-  return partitions_v;
-}
-
 int RedisDriver::initialize(CephContext* cct, const DoutPrefixProvider* dpp) 
 {
   if (partition_info.location.back() != '/') {
index 87815fb98dcd1495275cc69b08a2198595823b9d..b0b69522bdd2a34dc637e2adbf6ee8b7483dbdef 100644 (file)
@@ -25,18 +25,12 @@ class RedisDriver : public CacheDriver {
                                                                           outstanding_write_size(0)
     {
       conn = std::make_shared<connection>(boost::asio::make_strand(io_context));
-      add_partition_info(_partition_info);
-    }
-    virtual ~RedisDriver()
-    {
-      remove_partition_info(partition_info);
     }
+    virtual ~RedisDriver() {}
 
     /* Partition */
     virtual Partition get_current_partition_info(const DoutPrefixProvider* dpp) override { return partition_info; }
     virtual uint64_t get_free_space(const DoutPrefixProvider* dpp) override { return free_space; }
-    static std::optional<Partition> get_partition_info(const DoutPrefixProvider* dpp, const std::string& name, const std::string& type);
-    static std::vector<Partition> list_partitions(const DoutPrefixProvider* dpp);
 
     virtual int initialize(CephContext* cct, const DoutPrefixProvider* dpp) override;
     virtual int put(const DoutPrefixProvider* dpp, const std::string& key, bufferlist& bl, uint64_t len, rgw::sal::Attrs& attrs, optional_yield y) override;
@@ -73,14 +67,9 @@ class RedisDriver : public CacheDriver {
 
   protected:
     std::shared_ptr<connection> conn;
-
-    static std::unordered_map<std::string, Partition> partitions;
     Partition partition_info;
     uint64_t free_space;
     uint64_t outstanding_write_size;
-
-    int add_partition_info(Partition& info);
-    int remove_partition_info(Partition& info);
 };
 
 } } // namespace rgw::cache
index 56a9fb1a5e0bd0ee3bd193717cbb523651082d15..56b58b151effd7c6513c178ff9aec0ad8cb842ad 100644 (file)
@@ -18,49 +18,6 @@ namespace rgw { namespace cache {
 
 constexpr std::string_view ATTR_PREFIX = "user.rgw.";
 
-std::optional<Partition> SSDDriver::get_partition_info(const DoutPrefixProvider* dpp, const std::string& name, const std::string& type)
-{
-    std::string key = name + type;
-    auto iter = partitions.find(key);
-    if (iter != partitions.end()) {
-        return iter->second;
-    }
-
-    return std::nullopt;
-}
-
-std::vector<Partition> SSDDriver::list_partitions(const DoutPrefixProvider* dpp)
-{
-    std::vector<Partition> partitions_v;
-    for (auto& it : SSDDriver::partitions) {
-        partitions_v.emplace_back(it.second);
-    }
-    return partitions_v;
-}
-
-int SSDDriver::add_partition_info(Partition& info)
-{
-    std::string key = info.name + info.type;
-    auto ret = partitions.emplace(key, info);
-    return ret.second;
-}
-
-int SSDDriver::remove_partition_info(Partition& info)
-{
-    std::string key = info.name + info.type;
-    return partitions.erase(key);
-}
-
-SSDDriver::SSDDriver(Partition& partition_info) : partition_info(partition_info)
-{
-    add_partition_info(partition_info);
-}
-
-SSDDriver::~SSDDriver()
-{
-    remove_partition_info(partition_info);
-}
-
 int SSDDriver::initialize(CephContext* cct, const DoutPrefixProvider* dpp)
 {
     this->cct = cct;
index 962b5834e146d242c55b85049a7c55187ecc878a..4084a0aaa456bf3f5ce84f48eb3b52b51ca1a954 100644 (file)
@@ -8,8 +8,8 @@ namespace rgw { namespace cache {
 
 class SSDDriver : public CacheDriver {
 public:
-  SSDDriver(Partition& partition_info);
-  virtual ~SSDDriver();
+  SSDDriver(Partition& partition_info) : partition_info(partition_info) {}
+  virtual ~SSDDriver() {}
 
   virtual int initialize(CephContext* cct, const DoutPrefixProvider* dpp) override;
   virtual int put(const DoutPrefixProvider* dpp, const std::string& key, bufferlist& bl, uint64_t len, rgw::sal::Attrs& attrs, optional_yield y) override;
@@ -30,8 +30,6 @@ public:
   /* Partition */
   virtual Partition get_current_partition_info(const DoutPrefixProvider* dpp) override { return partition_info; }
   virtual uint64_t get_free_space(const DoutPrefixProvider* dpp) override { return free_space; }
-  static std::optional<Partition> get_partition_info(const DoutPrefixProvider* dpp, const std::string& name, const std::string& type);
-  static std::vector<Partition> list_partitions(const DoutPrefixProvider* dpp);
 
   struct libaio_handler {
     rgw::Aio* throttle = nullptr;
@@ -45,14 +43,10 @@ public:
   };
 
 protected:
-  inline static std::unordered_map<std::string, Partition> partitions;
   Partition partition_info;
   uint64_t free_space;
   CephContext* cct;
 
-  int add_partition_info(Partition& info);
-  int remove_partition_info(Partition& info);
-
 private:
 
 // unique_ptr with custom deleter for struct aiocb