1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
10 #include <seastar/core/future.hh>
11 #include <seastar/core/shared_future.hh>
13 #include "include/types.h"
14 #include "crimson/osd/osd_operation.h"
20 namespace crimson::osd
{
25 struct OSDMapBlocker
: public Blocker
{
26 const char * type_name
;
29 OSDMapBlocker(std::pair
<const char *, epoch_t
> args
)
30 : type_name(args
.first
), epoch(args
.second
) {}
32 OSDMapBlocker(const OSDMapBlocker
&) = delete;
33 OSDMapBlocker(OSDMapBlocker
&&) = delete;
34 OSDMapBlocker
&operator=(const OSDMapBlocker
&) = delete;
35 OSDMapBlocker
&operator=(OSDMapBlocker
&&) = delete;
37 seastar::shared_promise
<epoch_t
> promise
;
39 void dump_detail(Formatter
*f
) const final
;
41 const char *get_type_name() const final
{
46 // order the promises in ascending order of the waited osdmap epoch,
47 // so we can access all the waiters expecting a map whose epoch is less
48 // than or equal to a given epoch
49 using waiting_peering_t
= std::map
<epoch_t
,
51 const char *blocker_type
;
52 waiting_peering_t waiting_peering
;
54 std::optional
<std::reference_wrapper
<ShardServices
>> shard_services
;
55 bool stopping
= false;
58 const char *blocker_type
,
59 std::optional
<std::reference_wrapper
<ShardServices
>> shard_services
)
60 : blocker_type(blocker_type
), shard_services(shard_services
) {}
62 // wait for an osdmap whose epoch is greater or equal to given epoch
63 blocking_future
<epoch_t
> wait_for_map(epoch_t epoch
);
64 void got_map(epoch_t epoch
);
65 seastar::future
<> stop();