]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_realm_reloader.h
e4e3a4363425c3c00aedda7db8e0321cde064256
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef RGW_REALM_RELOADER_H
5 #define RGW_REALM_RELOADER_H
7 #include "rgw_realm_watcher.h"
8 #include "common/Cond.h"
13 * RGWRealmReloader responds to new period notifications by recreating RGWRados
14 * with the updated realm configuration.
16 class RGWRealmReloader
: public RGWRealmWatcher::Watcher
{
19 * Pauser is an interface to pause/resume frontends. Frontend cooperation
20 * is required to ensure that they stop issuing requests on the old
21 * RGWRados instance, and restart with the updated configuration.
23 * This abstraction avoids a depency on class RGWFrontend.
27 virtual ~Pauser() = default;
29 /// pause all frontends while realm reconfiguration is in progress
30 virtual void pause() = 0;
31 /// resume all frontends with the given RGWRados instance
32 virtual void resume(RGWRados
* store
) = 0;
35 RGWRealmReloader(RGWRados
*& store
, Pauser
* frontends
);
36 ~RGWRealmReloader() override
;
38 /// respond to realm notifications by scheduling a reload()
39 void handle_notify(RGWRealmNotify type
, bufferlist::iterator
& p
) override
;
42 /// pause frontends and replace the RGWRados instance
45 class C_Reload
; //< Context that calls reload()
47 /// main()'s RGWRados pointer as a reference, modified by reload()
49 Pauser
*const frontends
;
51 /// reload() takes a significant amount of time, so we don't want to run
52 /// it in the handle_notify() thread. we choose a timer thread instead of a
53 /// Finisher because it allows us to cancel events that were scheduled while
54 /// reload() is still running
56 Mutex mutex
; //< protects access to timer and reload_scheduled
57 Cond cond
; //< to signal reload() after an invalid realm config
58 C_Reload
* reload_scheduled
; //< reload() context if scheduled
61 #endif // RGW_REALM_RELOADER_H