#ifndef MGR_CLIENT_H_
#define MGR_CLIENT_H_
+#include "msg/Connection.h"
#include "msg/Dispatcher.h"
#include "mon/MgrMap.h"
-
-#include "msg/Connection.h"
+#include "osd/OSDHealthMetric.h"
#include "common/perf_counters.h"
#include "common/Timer.h"
Mutex lock = {"MgrClient::lock"};
uint32_t stats_period = 0;
+ uint32_t stats_threshold = 0;
SafeTimer timer;
CommandTable<MgrCommand> command_table;
// our reports (hook for use by OSD)
std::function<MPGStats*()> pgstats_cb;
+ // for service registration and beacon
+ bool service_daemon = false;
+ bool daemon_dirty_status = false;
+ std::string service_name, daemon_name;
+ std::map<std::string,std::string> daemon_metadata;
+ std::map<std::string,std::string> daemon_status;
+ std::vector<OSDHealthMetric> osd_health_metrics;
+
void reconnect();
+ void _send_open();
public:
MgrClient(CephContext *cct_, Messenger *msgr_);
bool handle_mgr_configure(MMgrConfigure *m);
bool handle_command_reply(MCommandReply *m);
- void send_report();
-
+ void send_pgstats();
void set_pgstats_cb(std::function<MPGStats*()> cb_)
{
Mutex::Locker l(lock);
int start_command(const vector<string>& cmd, const bufferlist& inbl,
bufferlist *outbl, string *outs,
Context *onfinish);
+
+ int service_daemon_register(
+ const std::string& service,
+ const std::string& name,
+ const std::map<std::string,std::string>& metadata);
+ int service_daemon_update_status(
+ const std::map<std::string,std::string>& status);
+ void update_osd_health(std::vector<OSDHealthMetric>&& metrics);
+
+private:
+ void _send_stats();
+ void _send_pgstats();
+ void _send_report();
};
#endif
-