]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | /* | |
4 | * Ceph - scalable distributed file system | |
5 | * | |
6 | * Copyright (C) 2016 John Spray <john.spray@redhat.com> | |
7 | * | |
8 | * This is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License version 2.1, as published by the Free Software | |
11 | * Foundation. See file COPYING. | |
12 | */ | |
13 | ||
14 | ||
15 | #ifndef MGR_STANDBY_H_ | |
16 | #define MGR_STANDBY_H_ | |
17 | ||
18 | #include "auth/Auth.h" | |
19 | #include "common/Finisher.h" | |
20 | #include "common/Timer.h" | |
21 | #include "common/LogClient.h" | |
22 | ||
23 | #include "client/Client.h" | |
24 | #include "mon/MonClient.h" | |
25 | #include "osdc/Objecter.h" | |
26 | ||
7c673cae FG |
27 | |
28 | class MMgrMap; | |
29 | class Mgr; | |
30 | ||
31 | class MgrStandby : public Dispatcher, | |
32 | public md_config_obs_t { | |
33 | public: | |
34 | // config observer bits | |
35 | const char** get_tracked_conf_keys() const override; | |
36 | void handle_conf_change(const struct md_config_t *conf, | |
37 | const std::set <std::string> &changed) override; | |
38 | ||
39 | protected: | |
40 | MonClient monc; | |
41 | std::unique_ptr<Messenger> client_messenger; | |
42 | Objecter objecter; | |
43 | Client client; | |
44 | ||
45 | LogClient log_client; | |
46 | LogChannelRef clog, audit_clog; | |
47 | ||
48 | Mutex lock; | |
49 | SafeTimer timer; | |
50 | ||
31f18b77 FG |
51 | std::shared_ptr<Mgr> active_mgr; |
52 | ||
53 | int orig_argc; | |
54 | const char **orig_argv; | |
7c673cae FG |
55 | |
56 | std::string state_str(); | |
57 | ||
58 | void handle_mgr_map(MMgrMap *m); | |
59 | void _update_log_config(); | |
31f18b77 | 60 | void send_beacon(); |
7c673cae FG |
61 | |
62 | public: | |
31f18b77 | 63 | MgrStandby(int argc, const char **argv); |
7c673cae FG |
64 | ~MgrStandby() override; |
65 | ||
66 | bool ms_dispatch(Message *m) override; | |
67 | bool ms_handle_reset(Connection *con) override { return false; } | |
68 | void ms_handle_remote_reset(Connection *con) override {} | |
69 | bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer, | |
70 | bool force_new) override; | |
71 | bool ms_handle_refused(Connection *con) override; | |
72 | ||
73 | int init(); | |
74 | void shutdown(); | |
31f18b77 | 75 | void respawn(); |
7c673cae FG |
76 | int main(vector<const char *> args); |
77 | void handle_signal(int signum); | |
31f18b77 | 78 | void tick(); |
7c673cae FG |
79 | }; |
80 | ||
81 | #endif | |
82 |