The id field can be used as the marker for log list / trim
operations.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
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;
struct cls_log_entry {
+ string id;
string section;
string name;
utime_t timestamp;
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)
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"));