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>
This commit is contained in:
Yehuda Sadeh 2013-06-29 18:21:15 -07:00
parent 064e92f000
commit ce7d816d9f
3 changed files with 9 additions and 5 deletions

View 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;

View 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)

View 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"));