]>
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
4 #ifndef RGW_PERIOD_PUSHER_H
5 #define RGW_PERIOD_PUSHER_H
11 #include "common/async/yield_context.h"
12 #include "rgw_realm_reloader.h"
22 // RGWRealmNotify payload for push coordination
23 using RGWZonesNeedPeriod
= RGWPeriod
;
26 * RGWPeriodPusher coordinates with other nodes via the realm watcher to manage
27 * the responsibility for pushing period updates to other zones or zonegroups.
29 class RGWPeriodPusher final
: public RGWRealmWatcher::Watcher
,
30 public RGWRealmReloader::Pauser
{
32 explicit RGWPeriodPusher(const DoutPrefixProvider
*dpp
, rgw::sal::RGWRadosStore
* store
, optional_yield y
);
33 ~RGWPeriodPusher() override
;
35 /// respond to realm notifications by pushing new periods to other zones
36 void handle_notify(RGWRealmNotify type
, bufferlist::const_iterator
& p
) override
;
38 /// avoid accessing RGWRados while dynamic reconfiguration is in progress.
39 /// notifications will be enqueued until resume()
40 void pause() override
;
42 /// continue processing notifications with a new RGWRados instance
43 void resume(rgw::sal::RGWRadosStore
* store
) override
;
46 void handle_notify(RGWZonesNeedPeriod
&& period
);
48 CephContext
*const cct
;
49 rgw::sal::RGWRadosStore
* store
;
52 epoch_t realm_epoch
{0}; //< the current realm epoch being sent
53 epoch_t period_epoch
{0}; //< the current period epoch being sent
55 /// while paused for reconfiguration, we need to queue up notifications
56 std::vector
<RGWZonesNeedPeriod
> pending_periods
;
58 class CRThread
; //< contains thread, coroutine manager, http manager
59 std::unique_ptr
<CRThread
> cr_thread
; //< thread to run the push coroutines
62 #endif // RGW_PERIOD_PUSHER_H