]> git.proxmox.com Git - ceph.git/blob - ceph/src/mgr/Mgr.h
0aa5b5c5be0c35eb5b1997b05a3d6841d385b634
[ceph.git] / ceph / src / mgr / Mgr.h
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) 2014 John Spray <john.spray@inktank.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 #ifndef CEPH_MGR_H_
15 #define CEPH_MGR_H_
16
17 // Python.h comes first because otherwise it clobbers ceph's assert
18 #include "Python.h"
19 // Python's pyconfig-64.h conflicts with ceph's acconfig.h
20 #undef HAVE_SYS_WAIT_H
21 #undef HAVE_UNISTD_H
22 #undef HAVE_UTIME_H
23 #undef _POSIX_C_SOURCE
24 #undef _XOPEN_SOURCE
25
26 #include "mds/FSMap.h"
27 #include "messages/MFSMap.h"
28 #include "msg/Messenger.h"
29 #include "auth/Auth.h"
30 #include "common/Finisher.h"
31 #include "common/Timer.h"
32
33 #include "DaemonServer.h"
34 #include "PyModules.h"
35
36 #include "DaemonState.h"
37 #include "ClusterState.h"
38
39 class MCommand;
40 class MMgrDigest;
41 class MLog;
42 class Objecter;
43 class Client;
44
45
46 class MgrPyModule;
47
48 class Mgr {
49 protected:
50 MonClient *monc;
51 Objecter *objecter;
52 Client *client;
53 Messenger *client_messenger;
54
55 Mutex lock;
56 SafeTimer timer;
57 Finisher finisher;
58
59 Cond fs_map_cond;
60
61 PyModules py_modules;
62 DaemonStateIndex daemon_state;
63 ClusterState cluster_state;
64
65 DaemonServer server;
66
67 void load_config();
68 void load_all_metadata();
69 void init();
70
71 bool initialized;
72 bool initializing;
73
74 public:
75 Mgr(MonClient *monc_, Messenger *clientm_, Objecter *objecter_,
76 Client *client_, LogChannelRef clog_, LogChannelRef audit_clog_);
77 ~Mgr();
78
79 bool is_initialized() const {return initialized;}
80 entity_addr_t get_server_addr() const { return server.get_myaddr(); }
81
82 void handle_mgr_digest(MMgrDigest* m);
83 void handle_fs_map(MFSMap* m);
84 void handle_osd_map();
85 void handle_log(MLog *m);
86
87 bool ms_dispatch(Message *m);
88
89 void tick();
90
91 void background_init();
92 void shutdown();
93 };
94
95 #endif