From: Patrick Donnelly Date: Thu, 10 Nov 2016 23:51:27 +0000 (-0500) Subject: mds: organize Beacon class members X-Git-Tag: v11.1.0~199^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=badae30dfced4c8191ed0e822fecbd43e67f4c2f;p=ceph.git mds: organize Beacon class members This amends the code to follow our C++ style guidelines with the goal of increasing header readability. Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/Beacon.cc b/src/mds/Beacon.cc index 24525df6614e..ec251fc24b2c 100644 --- a/src/mds/Beacon.cc +++ b/src/mds/Beacon.cc @@ -33,7 +33,6 @@ class Beacon::C_MDS_BeaconSender : public Context { - Beacon *beacon; public: explicit C_MDS_BeaconSender(Beacon *beacon_) : beacon(beacon_) {} void finish(int r) { @@ -41,6 +40,8 @@ public: beacon->sender = NULL; beacon->_send(); } +private: + Beacon *beacon; }; Beacon::Beacon(CephContext *cct_, MonClient *monc_, std::string name_) : diff --git a/src/mds/Beacon.h b/src/mds/Beacon.h index 9ac3888e7785..17ad0c671182 100644 --- a/src/mds/Beacon.h +++ b/src/mds/Beacon.h @@ -39,6 +39,42 @@ class MDSRank; */ class Beacon : public Dispatcher { +public: + Beacon(CephContext *cct_, MonClient *monc_, std::string name); + ~Beacon(); + + void init(MDSMap const *mdsmap); + void shutdown(); + + bool ms_dispatch(Message *m); + void ms_handle_connect(Connection *c) {} + bool ms_handle_reset(Connection *c) {return false;} + void ms_handle_remote_reset(Connection *c) {} + bool ms_handle_refused(Connection *c) {return false;} + + void notify_mdsmap(MDSMap const *mdsmap); + void notify_health(MDSRank const *mds); + + void handle_mds_beacon(MMDSBeacon *m); + void send(); + + void set_want_state(MDSMap const *mdsmap, MDSMap::DaemonState const newstate); + MDSMap::DaemonState get_want_state() const; + + /** + * Send a beacon, and block until the ack is received from the mon + * or `duration` seconds pass, whichever happens sooner. Useful + * for emitting a last message on shutdown. + */ + void send_and_wait(const double duration); + + bool is_laggy(); + utime_t get_laggy_until() const; + +private: + void _notify_mdsmap(MDSMap const *mdsmap); + void _send(); + //CephContext *cct; mutable Mutex lock; MonClient* monc; @@ -69,43 +105,8 @@ class Beacon : public Dispatcher class C_MDS_BeaconSender; C_MDS_BeaconSender *sender; - void _notify_mdsmap(MDSMap const *mdsmap); - void _send(); - version_t awaiting_seq; Cond waiting_cond; - -public: - Beacon(CephContext *cct_, MonClient *monc_, std::string name); - ~Beacon(); - - void init(MDSMap const *mdsmap); - void shutdown(); - - bool ms_dispatch(Message *m); - void ms_handle_connect(Connection *c) {} - bool ms_handle_reset(Connection *c) {return false;} - void ms_handle_remote_reset(Connection *c) {} - bool ms_handle_refused(Connection *c) {return false;} - - void notify_mdsmap(MDSMap const *mdsmap); - void notify_health(MDSRank const *mds); - - void handle_mds_beacon(MMDSBeacon *m); - void send(); - - void set_want_state(MDSMap const *mdsmap, MDSMap::DaemonState const newstate); - MDSMap::DaemonState get_want_state() const; - - /** - * Send a beacon, and block until the ack is received from the mon - * or `duration` seconds pass, whichever happens sooner. Useful - * for emitting a last message on shutdown. - */ - void send_and_wait(const double duration); - - bool is_laggy(); - utime_t get_laggy_until() const; }; #endif // BEACON_STATE_H