]> git.proxmox.com Git - ceph.git/blame - ceph/src/mgr/Mgr.h
update sources to v12.1.1
[ceph.git] / ceph / src / mgr / Mgr.h
CommitLineData
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) 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"
224ce89b 32#include "mon/MgrMap.h"
7c673cae
FG
33
34#include "DaemonServer.h"
35#include "PyModules.h"
36
37#include "DaemonState.h"
38#include "ClusterState.h"
39
40class MCommand;
41class MMgrDigest;
42class MLog;
224ce89b 43class MServiceMap;
7c673cae
FG
44class Objecter;
45class Client;
46
7c673cae
FG
47class MgrPyModule;
48
49class Mgr {
50protected:
51 MonClient *monc;
52 Objecter *objecter;
53 Client *client;
54 Messenger *client_messenger;
55
56 Mutex lock;
57 SafeTimer timer;
58 Finisher finisher;
59
224ce89b 60 // Track receipt of initial data during startup
7c673cae 61 Cond fs_map_cond;
224ce89b
WB
62 bool digest_received;
63 Cond digest_cond;
7c673cae
FG
64
65 PyModules py_modules;
66 DaemonStateIndex daemon_state;
67 ClusterState cluster_state;
68
69 DaemonServer server;
70
71 void load_config();
72 void load_all_metadata();
73 void init();
74
75 bool initialized;
76 bool initializing;
77
78public:
224ce89b
WB
79 Mgr(MonClient *monc_, const MgrMap& mgrmap,
80 Messenger *clientm_, Objecter *objecter_,
7c673cae
FG
81 Client *client_, LogChannelRef clog_, LogChannelRef audit_clog_);
82 ~Mgr();
83
84 bool is_initialized() const {return initialized;}
85 entity_addr_t get_server_addr() const { return server.get_myaddr(); }
86
87 void handle_mgr_digest(MMgrDigest* m);
88 void handle_fs_map(MFSMap* m);
89 void handle_osd_map();
90 void handle_log(MLog *m);
224ce89b
WB
91 void handle_service_map(MServiceMap *m);
92
93 bool got_mgr_map(const MgrMap& m);
7c673cae
FG
94
95 bool ms_dispatch(Message *m);
96
31f18b77
FG
97 void tick();
98
224ce89b 99 void background_init(Context *completion);
7c673cae
FG
100 void shutdown();
101};
102
103#endif