]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test wip-68195
authorDeepika Upadhyay <deepika.upadhyay@clyso.com>
Tue, 5 Nov 2024 08:34:43 +0000 (14:04 +0530)
committerDeepika Upadhyay <deepika.upadhyay@clyso.com>
Tue, 5 Nov 2024 11:25:07 +0000 (16:55 +0530)
Signed-off-by: Deepika Upadhyay <deepika.upadhyay@clyso.com>
src/rgw/rgw_common.h
src/rgw/rgw_op.cc
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_swift.cc

index a8f6a1107a919c5c6ad76a59df4935d2f12f0b3a..7a609ed738cc5fc4fa9b0f2bc5529bc2ae15b6f9 100644 (file)
@@ -1425,6 +1425,7 @@ struct RGWBucketEnt {
   size_t size;
   size_t size_rounded;
   ceph::real_time creation_time;
+  // ceph::real_time last_modified;
   uint64_t count;
 
   /* The placement_rule is necessary to calculate per-storage-policy statics
index 67829e6320a6ea73fd4689ab01c6fba42c41b47d..639c202c65bddb9b645580d13f13607d7f8888ce 100644 (file)
@@ -2681,6 +2681,7 @@ void RGWListBuckets::execute(optional_yield y)
       global_stats.bytes_used += ent.size;
       global_stats.bytes_used_rounded += ent.size_rounded;
       global_stats.objects_count += ent.count;
+      last_modified += ent.last_modified;
 
       /* operator[] still can create a new entry for storage policy seen
        * for first time. */
index a202d5acf4e1190121aa7915782a70d5e078f812..9870ad2c7bd37cb63b5ad105dc584d08ba833dba 100644 (file)
@@ -477,6 +477,33 @@ std::string dump_time_to_str(const real_time& t)
   return timestr;
 }
 
+static size_t dump_time_usec_impl(char (&timestr)[TIME_BUF_SIZE],
+                                    const real_time t)
+{
+  const utime_t ut(t);
+  time_t secs = static_cast<time_t>(ut.sec());
+
+  char buf[TIME_BUF_SIZE];
+  struct tm result;
+  const struct tm * const tmp = gmtime_r(&secs, &result);
+  if (tmp == nullptr) {
+    return 0;
+  }
+
+  if (strftime(buf, sizeof(buf), "%Y-%m-%dT%T", tmp) == 0)
+    return 0;
+
+  return snprintf(timestr, sizeof(timestr), "%s.%06d", buf, (int)(ut.usec()));
+}
+
+std::string dump_time_usec_to_str(const real_time& t)
+{
+  char timestr[TIME_BUF_SIZE];
+  dump_time_usec_impl(timestr, t);
+
+  return timestr;
+}
+
 
 void dump_last_modified(req_state *s, real_time t)
 {
index 3abba0124a6eda6d26ed8624c338cf0c929258c0..043c558247773c4cb627854e091fbb7463f7a943 100644 (file)
@@ -839,6 +839,7 @@ extern void dump_continue(req_state *s);
 extern void list_all_buckets_end(req_state *s);
 extern void dump_time(req_state *s, const char *name, real_time t);
 extern std::string dump_time_to_str(const real_time& t);
+extern std::string dump_time_usec_to_str(const real_time& t);
 extern void dump_bucket_from_state(req_state *s);
 extern void dump_redirect(req_state *s, const std::string& redirect);
 extern bool is_valid_url(const char *url);
index 35c36d1ae1a66cc94b916316d98be21668e29b9f..66dd85300f331c4f7a800bb68cdd768b9e6649e2 100644 (file)
@@ -361,6 +361,7 @@ void RGWListBuckets_ObjStore_SWIFT::dump_bucket_entry(const RGWBucketEnt& ent)
   if (need_stats) {
     s->formatter->dump_int("count", ent.count);
     s->formatter->dump_int("bytes", ent.size);
+    s->formatter->dump_string("last_modified", dump_time_usec_to_str(s->bucket_mtime));
   }
 
   s->formatter->close_section();