1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef RGW_PERIOD_PUSHER_H
5 #define RGW_PERIOD_PUSHER_H
11 #include "rgw_realm_reloader.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 RGWPeriodPusher(RGWRados* store);
27 ~RGWPeriodPusher() override;
29 /// respond to realm notifications by pushing new periods to other zones
30 void handle_notify(RGWRealmNotify type, bufferlist::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(RGWRados* store) override;
40 void handle_notify(RGWZonesNeedPeriod&& period);
42 CephContext *const cct;
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
56 #endif // RGW_PERIOD_PUSHER_H