]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: a few minor code clean-ups
authorJ. Eric Ivancich <ivancich@redhat.com>
Wed, 5 Jul 2023 21:05:06 +0000 (17:05 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Wed, 30 Aug 2023 18:41:15 +0000 (14:41 -0400)
Includes code documentation, formatting fixes, and removing an
unimplemented function from an interface.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h
src/rgw/rgw_common.h

index 8048f1bcab47fcb2a16740e7afc43ffb73757948..2743ff8a8dc23ba7f51b1228acdd986e323d5c12 100644 (file)
@@ -6695,18 +6695,17 @@ int RGWRados::Bucket::UpdateIndex::prepare(const DoutPrefixProvider *dpp, RGWMod
   int r = guard_reshard(dpp, obj, nullptr, [&](BucketShard *bs) -> int {
                                   return store->cls_obj_prepare_op(dpp, *bs, op, optag, obj, bilog_flags, y, zones_trace);
                                 }, y);
-
   if (r < 0) {
     return r;
   }
-  prepared = true;
 
+  prepared = true;
   return 0;
 }
 
 int RGWRados::Bucket::UpdateIndex::complete(const DoutPrefixProvider *dpp, int64_t poolid, uint64_t epoch,
                                             uint64_t size, uint64_t accounted_size,
-                                            ceph::real_time& ut, const string& etag,
+                                            const ceph::real_time& ut, const string& etag,
                                             const string& content_type, const string& storage_class,
                                             bufferlist *acl_bl,
                                             RGWObjCategory category,
index 47b6bc61710f22c6be8e5993b15c45c74a971e3e..4779ad592095ccc6ef9fd86970ab701249a58aff 100644 (file)
@@ -422,7 +422,6 @@ class RGWRados
                         RGWObjManifest** pmanifest, optional_yield y);
 
   int update_placement_map();
-  int store_bucket_info(RGWBucketInfo& info, std::map<std::string, bufferlist> *pattrs, RGWObjVersionTracker *objv_tracker, bool exclusive);
 
   void remove_rgw_head_obj(librados::ObjectWriteOperation& op);
   void cls_obj_check_prefix_exist(librados::ObjectOperation& op, const std::string& prefix, bool fail_if_exist);
@@ -781,7 +780,7 @@ public:
       int read(int64_t ofs, int64_t end, bufferlist& bl, optional_yield y, const DoutPrefixProvider *dpp);
       int iterate(const DoutPrefixProvider *dpp, int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y);
       int get_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& dest, optional_yield y);
-    };
+    }; // struct RGWRados::Object::Read
 
     struct Write {
       RGWRados::Object *target;
@@ -827,7 +826,7 @@ public:
       const req_state* get_req_state() {
         return nullptr;  /* XXX dang Only used by LTTng, and it handles null anyway */
       }
-    };
+    }; // struct RGWRados::Object::Write
 
     struct Delete {
       RGWRados::Object *target;
@@ -861,7 +860,7 @@ public:
       explicit Delete(RGWRados::Object *_target) : target(_target) {}
 
       int delete_obj(optional_yield y, const DoutPrefixProvider *dpp);
-    };
+    }; // struct RGWRados::Object::Delete
 
     struct Stat {
       RGWRados::Object *source;
@@ -882,16 +881,15 @@ public:
         State() : completion(NULL), ret(0) {}
       } state;
 
-
       explicit Stat(RGWRados::Object *_source) : source(_source) {}
 
       int stat_async(const DoutPrefixProvider *dpp);
       int wait(const DoutPrefixProvider *dpp);
-      int stat();
+
     private:
       int finish(const DoutPrefixProvider *dpp);
-    };
-  };
+    }; // struct RGWRados::Object::Stat
+  }; // class RGWRados::Object
 
   class Bucket {
     RGWRados *store;
@@ -939,12 +937,14 @@ public:
       }
 
       int guard_reshard(const DoutPrefixProvider *dpp, const rgw_obj& obj_instance, BucketShard **pbs, std::function<int(BucketShard *)> call, optional_yield y);
+
     public:
 
-      UpdateIndex(RGWRados::Bucket *_target, const rgw_obj& _obj) : target(_target), obj(_obj),
-                                                              bs(target->get_store()) {
-                                                                blind = (target->get_bucket_info().layout.current_index.layout.type == rgw::BucketIndexType::Indexless);
-                                                              }
+      UpdateIndex(RGWRados::Bucket *_target, const rgw_obj& _obj) : target(_target),
+                                                                   obj(_obj),
+                                                                   bs(target->get_store()) {
+       blind = target->get_bucket_info().layout.current_index.layout.type == rgw::BucketIndexType::Indexless;
+      }
 
       int get_bucket_shard(BucketShard **pbs, const DoutPrefixProvider *dpp, optional_yield y) {
         if (!bs_initialized) {
@@ -967,7 +967,7 @@ public:
 
       int prepare(const DoutPrefixProvider *dpp, RGWModifyOp, const std::string *write_tag, optional_yield y);
       int complete(const DoutPrefixProvider *dpp, int64_t poolid, uint64_t epoch, uint64_t size,
-                   uint64_t accounted_size, ceph::real_time& ut,
+                   uint64_t accounted_size, const ceph::real_time& ut,
                    const std::string& etag, const std::string& content_type,
                    const std::string& storage_class,
                    bufferlist *acl_bl, RGWObjCategory category,
@@ -987,7 +987,7 @@ public:
       const std::string *get_optag() { return &optag; }
 
       bool is_prepared() { return prepared; }
-    }; // class UpdateIndex
+    }; // class RGWRados::Bucket::UpdateIndex
 
     class List {
     protected:
@@ -1051,8 +1051,8 @@ public:
       rgw_obj_key& get_next_marker() {
         return next_marker;
       }
-    }; // class List
-  }; // class Bucket
+    }; // class RGWRados::Bucket::List
+  }; // class RGWRados::Bucket
 
   int on_last_entry_in_listing(const DoutPrefixProvider *dpp,
                                RGWBucketInfo& bucket_info,
index 67333be998856faa76a1b7878ed3f7bea5f69ca1..c1fe2ee2abeeef0b9985f6e1efa169a216d341a8 100644 (file)
@@ -75,8 +75,8 @@ using ceph::crypto::MD5;
 #define RGW_SYS_PARAM_PREFIX "rgwx-"
 
 #define RGW_ATTR_ACL           RGW_ATTR_PREFIX "acl"
-#define RGW_ATTR_RATELIMIT             RGW_ATTR_PREFIX "ratelimit"
-#define RGW_ATTR_LC            RGW_ATTR_PREFIX "lc"
+#define RGW_ATTR_RATELIMIT     RGW_ATTR_PREFIX "ratelimit"
+#define RGW_ATTR_LC            RGW_ATTR_PREFIX "lc"
 #define RGW_ATTR_CORS          RGW_ATTR_PREFIX "cors"
 #define RGW_ATTR_ETAG          RGW_ATTR_PREFIX "etag"
 #define RGW_ATTR_BUCKETS       RGW_ATTR_PREFIX "buckets"