summaryrefslogtreecommitdiffstats
path: root/src/cls/log/cls_log_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cls/log/cls_log_types.h')
-rw-r--r--src/cls/log/cls_log_types.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/cls/log/cls_log_types.h b/src/cls/log/cls_log_types.h
new file mode 100644
index 000000000..1746d243e
--- /dev/null
+++ b/src/cls/log/cls_log_types.h
@@ -0,0 +1,74 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+#ifndef CEPH_CLS_LOG_TYPES_H
+#define CEPH_CLS_LOG_TYPES_H
+
+#include "include/encoding.h"
+#include "include/types.h"
+
+#include "include/utime.h"
+
+class JSONObj;
+
+
+struct cls_log_entry {
+ std::string id;
+ std::string section;
+ std::string name;
+ utime_t timestamp;
+ ceph::buffer::list data;
+
+ cls_log_entry() {}
+
+ void encode(ceph::buffer::list& bl) const {
+ 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(ceph::buffer::list::const_iterator& 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);
+ }
+};
+WRITE_CLASS_ENCODER(cls_log_entry)
+
+struct cls_log_header {
+ std::string max_marker;
+ utime_t max_time;
+
+ void encode(ceph::buffer::list& bl) const {
+ ENCODE_START(1, 1, bl);
+ encode(max_marker, bl);
+ encode(max_time, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(ceph::buffer::list::const_iterator& bl) {
+ DECODE_START(1, bl);
+ decode(max_marker, bl);
+ decode(max_time, bl);
+ DECODE_FINISH(bl);
+ }
+};
+inline bool operator ==(const cls_log_header& lhs, const cls_log_header& rhs) {
+ return (lhs.max_marker == rhs.max_marker &&
+ lhs.max_time == rhs.max_time);
+}
+inline bool operator !=(const cls_log_header& lhs, const cls_log_header& rhs) {
+ return !(lhs == rhs);
+}
+WRITE_CLASS_ENCODER(cls_log_header)
+
+
+#endif