]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MTimeCheck2.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2012 Inktank, Inc.
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
17 class MTimeCheck2
: public MessageInstance
<MTimeCheck2
> {
21 static constexpr int HEAD_VERSION
= 1;
22 static constexpr int COMPAT_VERSION
= 1;
35 map
<int, double> skews
;
36 map
<int, double> latencies
;
38 MTimeCheck2() : MessageInstance(MSG_TIMECHECK2
, HEAD_VERSION
, COMPAT_VERSION
) { }
40 MessageInstance(MSG_TIMECHECK2
, HEAD_VERSION
, COMPAT_VERSION
),
45 ~MTimeCheck2() override
{ }
48 std::string_view
get_type_name() const override
{ return "time_check2"; }
49 const char *get_op_name() const {
51 case OP_PING
: return "ping";
52 case OP_PONG
: return "pong";
53 case OP_REPORT
: return "report";
57 void print(ostream
&o
) const override
{
58 o
<< "time_check( " << get_op_name()
59 << " e " << epoch
<< " r " << round
;
61 o
<< " ts " << timestamp
;
62 } else if (op
== OP_REPORT
) {
63 o
<< " #skews " << skews
.size()
64 << " #latencies " << latencies
.size();
69 void decode_payload() override
{
70 auto p
= payload
.cbegin();
79 void encode_payload(uint64_t features
) override
{
82 encode(epoch
, payload
);
83 encode(round
, payload
);
84 encode(timestamp
, payload
);
85 encode(skews
, payload
, features
);
86 encode(latencies
, payload
, features
);