]>
git.proxmox.com Git - ceph.git/blob - ceph/src/crimson/mgr/client.h
e8457543305681defdb7c7881bda2640e87512a3
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
6 #include <seastar/core/timer.hh>
8 #include "crimson/common/gated.h"
9 #include "crimson/net/Dispatcher.h"
10 #include "crimson/net/Fwd.h"
11 #include "mon/MgrMap.h"
13 template<typename Message
> using Ref
= boost::intrusive_ptr
<Message
>;
14 namespace crimson::net
{
21 namespace crimson::mgr
24 // implement WithStats if you want to report stats to mgr periodically
27 virtual seastar::future
<MessageURef
> get_stats() const = 0;
28 virtual ~WithStats() {}
31 class Client
: public crimson::net::Dispatcher
{
33 Client(crimson::net::Messenger
& msgr
,
34 WithStats
& with_stats
);
35 seastar::future
<> start();
36 seastar::future
<> stop();
40 std::optional
<seastar::future
<>> ms_dispatch(
41 crimson::net::ConnectionRef conn
, Ref
<Message
> m
) override
;
42 void ms_handle_reset(crimson::net::ConnectionRef conn
, bool is_replace
) final
;
43 void ms_handle_connect(crimson::net::ConnectionRef conn
) final
;
44 seastar::future
<> handle_mgr_map(crimson::net::ConnectionRef conn
,
46 seastar::future
<> handle_mgr_conf(crimson::net::ConnectionRef conn
,
47 Ref
<MMgrConfigure
> m
);
48 seastar::future
<> reconnect();
50 void print(std::ostream
&) const;
51 friend std::ostream
& operator<<(std::ostream
& out
, const Client
& client
);
54 crimson::net::Messenger
& msgr
;
55 WithStats
& with_stats
;
56 crimson::net::ConnectionRef conn
;
57 seastar::timer
<seastar::lowres_clock
> report_timer
;
58 crimson::common::Gated gate
;
61 inline std::ostream
& operator<<(std::ostream
& out
, const Client
& client
) {
68 #if FMT_VERSION >= 90000
69 template <> struct fmt::formatter
<crimson::mgr::Client
> : fmt::ostream_formatter
{};