diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-29 18:21:15 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-29 20:39:00 -0700 |
commit | ce7d816d9f84a06a8199ce5601920d02c17c8380 (patch) | |
tree | a905fe7cd3af3ce6ee9ea4550dffb3fb4a7d6800 | |
parent | 064e92f000eb2a0cf57604e7d614510a2e016a34 (diff) | |
download | ceph-ce7d816d9f84a06a8199ce5601920d02c17c8380.tar.gz |
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 <yehuda@inktank.com>
-rw-r--r-- | src/cls/log/cls_log.cc | 2 | ||||
-rw-r--r-- | src/cls/log/cls_log_types.h | 11 | ||||
-rw-r--r-- | src/rgw/rgw_metadata.cc | 1 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/cls/log/cls_log.cc b/src/cls/log/cls_log.cc index 76125e1a1db..b7a2a870f9a 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 06684d9e5d4..13dd7a34a95 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 7ace5b317a6..e0934193d5a 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")); |