]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_realm_reloader.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_REALM_RELOADER_H
5 #define RGW_REALM_RELOADER_H
7 #include "rgw_realm_watcher.h"
8 #include "common/Cond.h"
17 * RGWRealmReloader responds to new period notifications by recreating RGWRados
18 * with the updated realm configuration.
20 class RGWRealmReloader
: public RGWRealmWatcher::Watcher
{
23 * Pauser is an interface to pause/resume frontends. Frontend cooperation
24 * is required to ensure that they stop issuing requests on the old
25 * RGWRados instance, and restart with the updated configuration.
27 * This abstraction avoids a dependency on class RGWFrontend.
31 virtual ~Pauser() = default;
33 /// pause all frontends while realm reconfiguration is in progress
34 virtual void pause() = 0;
35 /// resume all frontends with the given RGWRados instance
36 virtual void resume(rgw::sal::Store
* store
) = 0;
39 RGWRealmReloader(rgw::sal::Store
*& store
, std::map
<std::string
, std::string
>& service_map_meta
,
41 ~RGWRealmReloader() override
;
43 /// respond to realm notifications by scheduling a reload()
44 void handle_notify(RGWRealmNotify type
, bufferlist::const_iterator
& p
) override
;
47 /// pause frontends and replace the RGWRados instance
50 class C_Reload
; //< Context that calls reload()
52 /// main()'s Store pointer as a reference, modified by reload()
53 rgw::sal::Store
*& store
;
54 std::map
<std::string
, std::string
>& service_map_meta
;
55 Pauser
*const frontends
;
57 /// reload() takes a significant amount of time, so we don't want to run
58 /// it in the handle_notify() thread. we choose a timer thread instead of a
59 /// Finisher because it allows us to cancel events that were scheduled while
60 /// reload() is still running
62 ceph::mutex mutex
; //< protects access to timer and reload_scheduled
63 ceph::condition_variable cond
; //< to signal reload() after an invalid realm config
64 C_Reload
* reload_scheduled
; //< reload() context if scheduled
67 #endif // RGW_REALM_RELOADER_H