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
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. */
return timestr;
}
+static size_t dump_time_usec_impl(char (×tr)[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)
{
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);
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();