]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/log: Add non-default constructors to cls_log_entry
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 24 Jan 2023 06:53:20 +0000 (01:53 -0500)
committerAdam Emerson <aemerson@redhat.com>
Thu, 14 Sep 2023 21:48:00 +0000 (17:48 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/cls/log/cls_log_types.h

index 33b8cce51e5e8c792f4c9253bc2349fb5ec2f59b..7b00fe501568f8a41358d09c6725447b07ffb4e1 100644 (file)
@@ -3,9 +3,11 @@
 #ifndef CEPH_CLS_LOG_TYPES_H
 #define CEPH_CLS_LOG_TYPES_H
 
+#include <string>
+
+#include "include/buffer.h"
 #include "include/encoding.h"
 #include "include/types.h"
-
 #include "include/utime.h"
 
 #include "common/ceph_json.h"
@@ -14,7 +16,6 @@
 class JSONObj;
 class JSONDecoder;
 
-
 struct cls_log_entry {
   std::string id;
   std::string section;
@@ -22,7 +23,17 @@ struct cls_log_entry {
   utime_t timestamp;
   ceph::buffer::list data;
 
-  cls_log_entry() {}
+  cls_log_entry() = default;
+
+  cls_log_entry(ceph::real_time timestamp, std::string section,
+               std::string name, ceph::buffer::list&& data)
+    : section(std::move(section)), name(std::move(name)),
+      timestamp(utime_t(timestamp)), data(std::move(data)) {}
+
+  cls_log_entry(utime_t timestamp, std::string section,
+               std::string name, ceph::buffer::list&& data)
+    : section(std::move(section)), name(std::move(name)), timestamp(timestamp),
+      data(std::move(data)) {}
 
   void encode(ceph::buffer::list& bl) const {
     ENCODE_START(2, 1, bl);