From: Adam C. Emerson Date: Tue, 24 Jan 2023 06:53:20 +0000 (-0500) Subject: cls/log: Add non-default constructors to cls_log_entry X-Git-Tag: testing/wip-vshankar-testing-20250407.170244-debug~16^2~30 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5aa0358ca925f7827f626cf4236d3a775e40ab82;p=ceph-ci.git cls/log: Add non-default constructors to cls_log_entry Signed-off-by: Adam C. Emerson --- 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);