]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/otp: implement otp_info_t::dump()
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 4 Dec 2017 07:48:04 +0000 (23:48 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 9 Apr 2018 14:01:02 +0000 (07:01 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/CMakeLists.txt
src/cls/otp/cls_otp_types.cc [new file with mode: 0644]
src/cls/otp/cls_otp_types.h

index d6a401b405a250aff72eb96b7c6d0d3d57d5bf4b..48bb3b6084b7be60c5c623fb8289c2d1cf7dbcfc 100644 (file)
@@ -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 (file)
index 0000000..98c4d25
--- /dev/null
@@ -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 <sage@newdream.net>
+ *
+ * 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);
+}
+
index e4b62aca535c8c80a4f70e15336b69f118596024..29b9837dacc865bec5729b35b99c98c7c1971cc5 100644 (file)
@@ -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)