From 5aa0358ca925f7827f626cf4236d3a775e40ab82 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 24 Jan 2023 01:53:20 -0500 Subject: [PATCH] cls/log: Add non-default constructors to cls_log_entry Signed-off-by: Adam C. Emerson --- src/cls/log/cls_log_types.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/cls/log/cls_log_types.h b/src/cls/log/cls_log_types.h index 29aa2bae8fe..c0be0513366 100644 --- a/src/cls/log/cls_log_types.h +++ b/src/cls/log/cls_log_types.h @@ -3,9 +3,11 @@ #ifndef CEPH_CLS_LOG_TYPES_H #define CEPH_CLS_LOG_TYPES_H +#include + +#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); -- 2.39.5