]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: cls_log_entry has id field
authorYehuda Sadeh <yehuda@inktank.com>
Sun, 30 Jun 2013 01:21:15 +0000 (18:21 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Sun, 30 Jun 2013 03:39:00 +0000 (20:39 -0700)
The id field can be used as the marker for log list / trim
operations.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/cls/log/cls_log.cc
src/cls/log/cls_log_types.h
src/rgw/rgw_metadata.cc

index 76125e1a1db9be9bb6f27e15b356efc9a7dc6ffe..b7a2a870f9ae784677eac6e43bafbe669d405b90 100644 (file)
@@ -80,6 +80,8 @@ static int cls_log_add(cls_method_context_t hctx, bufferlist *in, bufferlist *ou
 
     CLS_LOG(0, "storing entry at %s", index.c_str());
 
+    entry.id = index;
+
     int ret = write_log_entry(hctx, index, entry);
     if (ret < 0)
       return ret;
index 06684d9e5d45a8262ed339c75be9d130f170d301..13dd7a34a9590ffcfcae82acbe7b53da11e27bf9 100644 (file)
@@ -10,6 +10,7 @@ class JSONObj;
 
 
 struct cls_log_entry {
+  string id;
   string section;
   string name;
   utime_t timestamp;
@@ -18,25 +19,25 @@ struct cls_log_entry {
   cls_log_entry() {}
 
   void encode(bufferlist& bl) const {
-    ENCODE_START(1, 1, bl);
+    ENCODE_START(2, 1, bl);
     ::encode(section, bl);
     ::encode(name, bl);
     ::encode(timestamp, bl);
     ::encode(data, bl);
+    ::encode(id, bl);
     ENCODE_FINISH(bl);
   }
 
   void decode(bufferlist::iterator& bl) {
-    DECODE_START(1, bl);
+    DECODE_START(2, bl);
     ::decode(section, bl);
     ::decode(name, bl);
     ::decode(timestamp, bl);
     ::decode(data, bl);
+    if (struct_v >= 2)
+      ::decode(id, bl);
     DECODE_FINISH(bl);
   }
-
-  void dump(Formatter *f) const;
-  void decode_json(JSONObj *obj);
 };
 WRITE_CLASS_ENCODER(cls_log_entry)
 
index 7ace5b317a6fcad0ea768c9d43a9a89b65d5bc7c..e0934193d5ab41bfb71a8bb1df43a02eab20aea1 100644 (file)
@@ -451,6 +451,7 @@ void RGWMetadataManager::list_keys_complete(void *handle)
 void RGWMetadataManager::dump_log_entry(cls_log_entry& entry, Formatter *f)
 {
   f->open_object_section("entry");
+  f->dump_string("id", entry.id);
   f->dump_string("section", entry.section);
   f->dump_string("name", entry.name);
   entry.timestamp.gmtime(f->dump_stream("timestamp"));