]>
git.proxmox.com Git - ceph.git/blob - ceph/src/crimson/osd/chained_dispatchers.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
2 // vim: ts=8 sw=2 smarttab
7 #include "crimson/net/Dispatcher.h"
9 // in existing Messenger, dispatchers are put into a chain as described by
10 // chain-of-responsibility pattern. we could do the same to stop processing
11 // the message once any of the dispatchers claims this message, and prevent
12 // other dispatchers from reading it. but this change is more involved as
13 // it requires changing the ms_ methods to return a bool. so as an intermediate
14 // solution, we are using an observer dispatcher to notify all the interested
15 // or unintersted parties.
16 class ChainedDispatchers
: public crimson::net::Dispatcher
{
17 std::deque
<Dispatcher
*> dispatchers
;
19 void push_front(Dispatcher
* dispatcher
) {
20 dispatchers
.push_front(dispatcher
);
22 void push_back(Dispatcher
* dispatcher
) {
23 dispatchers
.push_back(dispatcher
);
25 seastar::future
<> ms_dispatch(crimson::net::Connection
* conn
, MessageRef m
) override
;
26 seastar::future
<> ms_handle_accept(crimson::net::ConnectionRef conn
) override
;
27 seastar::future
<> ms_handle_connect(crimson::net::ConnectionRef conn
) override
;
28 seastar::future
<> ms_handle_reset(crimson::net::ConnectionRef conn
) override
;
29 seastar::future
<> ms_handle_remote_reset(crimson::net::ConnectionRef conn
) override
;