]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_period_pusher.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
10 #include "common/async/yield_context.h"
11 #include "rgw_realm_reloader.h"
12 #include "rgw_sal_fwd.h"
16 // RGWRealmNotify payload for push coordination
17 using RGWZonesNeedPeriod
= RGWPeriod
;
20 * RGWPeriodPusher coordinates with other nodes via the realm watcher to manage
21 * the responsibility for pushing period updates to other zones or zonegroups.
23 class RGWPeriodPusher final
: public RGWRealmWatcher::Watcher
,
24 public RGWRealmReloader::Pauser
{
26 explicit RGWPeriodPusher(const DoutPrefixProvider
*dpp
, rgw::sal::Driver
* driver
, optional_yield y
);
27 ~RGWPeriodPusher() override
;
29 /// respond to realm notifications by pushing new periods to other zones
30 void handle_notify(RGWRealmNotify type
, bufferlist::const_iterator
& p
) override
;
32 /// avoid accessing RGWRados while dynamic reconfiguration is in progress.
33 /// notifications will be enqueued until resume()
34 void pause() override
;
36 /// continue processing notifications with a new RGWRados instance
37 void resume(rgw::sal::Driver
* driver
) override
;
40 void handle_notify(RGWZonesNeedPeriod
&& period
);
42 CephContext
*const cct
;
43 rgw::sal::Driver
* driver
;
46 epoch_t realm_epoch
{0}; //< the current realm epoch being sent
47 epoch_t period_epoch
{0}; //< the current period epoch being sent
49 /// while paused for reconfiguration, we need to queue up notifications
50 std::vector
<RGWZonesNeedPeriod
> pending_periods
;
52 class CRThread
; //< contains thread, coroutine manager, http manager
53 std::unique_ptr
<CRThread
> cr_thread
; //< thread to run the push coroutines