From: Yehuda Sadeh Date: Sun, 30 Jun 2013 01:21:15 +0000 (-0700) Subject: rgw: cls_log_entry has id field X-Git-Tag: v0.67-rc1~128^2~18^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce7d816d9f84a06a8199ce5601920d02c17c8380;p=ceph.git rgw: cls_log_entry has id field The id field can be used as the marker for log list / trim operations. Signed-off-by: Yehuda Sadeh --- diff --git a/src/cls/log/cls_log.cc b/src/cls/log/cls_log.cc index 76125e1a1db9..b7a2a870f9ae 100644 --- a/src/cls/log/cls_log.cc +++ b/src/cls/log/cls_log.cc @@ -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; diff --git a/src/cls/log/cls_log_types.h b/src/cls/log/cls_log_types.h index 06684d9e5d45..13dd7a34a959 100644 --- a/src/cls/log/cls_log_types.h +++ b/src/cls/log/cls_log_types.h @@ -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) diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index 7ace5b317a6f..e0934193d5ab 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -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"));