From: Yehuda Sadeh Date: Mon, 4 Dec 2017 07:48:04 +0000 (-0800) Subject: cls/otp: implement otp_info_t::dump() X-Git-Tag: v13.1.0~343^2~27 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=af36c088717ac8028ffe40b025d17be85292e9b0;p=ceph-ci.git cls/otp: implement otp_info_t::dump() Signed-off-by: Yehuda Sadeh --- diff --git a/src/cls/CMakeLists.txt b/src/cls/CMakeLists.txt index d6a401b405a..48bb3b6084b 100644 --- a/src/cls/CMakeLists.txt +++ b/src/cls/CMakeLists.txt @@ -80,8 +80,7 @@ install(TARGETS cls_otp DESTINATION ${cls_dir}) set(cls_otp_client_srcs otp/cls_otp_client.cc -# otp/cls_otp_types.cc -# otp/cls_otp_ops.cc + otp/cls_otp_types.cc ) add_library(cls_otp_client STATIC ${cls_otp_client_srcs}) list(APPEND cls_embedded_srcs ${cls_otp_srcs} ${cls_otp_client_srcs}) diff --git a/src/cls/otp/cls_otp_types.cc b/src/cls/otp/cls_otp_types.cc new file mode 100644 index 00000000000..98c4d2560c4 --- /dev/null +++ b/src/cls/otp/cls_otp_types.cc @@ -0,0 +1,34 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2004-2006 Sage Weil + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#include "common/Formatter.h" +#include "common/Clock.h" +#include "common/ceph_json.h" + +#include "include/utime.h" + +#include "cls/otp/cls_otp_types.h" + +using namespace rados::cls::otp; + +void otp_info_t::dump(Formatter *f) const +{ + encode_json("type", (int)type, f); + encode_json("id", id, f); + encode_json("seed", seed, f); + encode_json("time_ofs", utime_t(time_ofs), f); + encode_json("step_size", step_size, f); + encode_json("window", window, f); +} + diff --git a/src/cls/otp/cls_otp_types.h b/src/cls/otp/cls_otp_types.h index e4b62aca535..29b9837dacc 100644 --- a/src/cls/otp/cls_otp_types.h +++ b/src/cls/otp/cls_otp_types.h @@ -52,6 +52,7 @@ namespace rados { ::decode(window, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; }; WRITE_CLASS_ENCODER(rados::cls::otp::otp_info_t)