]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MTimeCheck.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.
15 #ifndef CEPH_MTIMECHECK_H
16 #define CEPH_MTIMECHECK_H
18 class MTimeCheck final
: public Message
{
20 static constexpr int HEAD_VERSION
= 1;
33 map
<entity_inst_t
, double> skews
;
34 map
<entity_inst_t
, double> latencies
;
36 MTimeCheck() : Message
{MSG_TIMECHECK
, HEAD_VERSION
} {}
38 Message
{MSG_TIMECHECK
, HEAD_VERSION
},
43 ~MTimeCheck() final
{}
46 std::string_view
get_type_name() const override
{ return "time_check"; }
47 const char *get_op_name() const {
49 case OP_PING
: return "ping";
50 case OP_PONG
: return "pong";
51 case OP_REPORT
: return "report";
55 void print(std::ostream
&o
) const override
{
56 o
<< "time_check( " << get_op_name()
57 << " e " << epoch
<< " r " << round
;
59 o
<< " ts " << timestamp
;
60 } else if (op
== OP_REPORT
) {
61 o
<< " #skews " << skews
.size()
62 << " #latencies " << latencies
.size();
67 void decode_payload() override
{
69 auto p
= payload
.cbegin();
78 void encode_payload(uint64_t features
) override
{
81 encode(epoch
, payload
);
82 encode(round
, payload
);
83 encode(timestamp
, payload
);
84 encode(skews
, payload
, features
);
85 encode(latencies
, payload
, features
);
88 template<class T
, typename
... Args
>
89 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);
92 #endif /* CEPH_MTIMECHECK_H */