]> git.apps.os.sepia.ceph.com Git - ceph-ci.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 C. Emerson <aemerson@redhat.com>
Tue, 1 Apr 2025 15:10:13 +0000 (11:10 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/cls/log/cls_log_types.h

index 29aa2bae8fe972e9660049de2fe4f4e4e1340b5c..c0be051336691cfdcb2cc765d05c2397828a31fb 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);