X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fmgr%2FMgrClient.h;fp=src%2Fceph%2Fsrc%2Fmgr%2FMgrClient.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=08ff24c23849428219570c0446a88813f927b8a2;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/mgr/MgrClient.h b/src/ceph/src/mgr/MgrClient.h deleted file mode 100644 index 08ff24c..0000000 --- a/src/ceph/src/mgr/MgrClient.h +++ /dev/null @@ -1,125 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2016 John Spray - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - */ - -#ifndef MGR_CLIENT_H_ -#define MGR_CLIENT_H_ - -#include "msg/Dispatcher.h" -#include "mon/MgrMap.h" - -#include "msg/Connection.h" - -#include "common/perf_counters.h" -#include "common/Timer.h" -#include "common/CommandTable.h" - -class MMgrMap; -class MMgrConfigure; -class Messenger; -class MCommandReply; -class MPGStats; - -class MgrSessionState -{ - public: - // Which performance counters have we already transmitted schema for? - std::set declared; - - // Our connection to the mgr - ConnectionRef con; -}; - -class MgrCommand : public CommandOp -{ - public: - - MgrCommand(ceph_tid_t t) : CommandOp(t) {} - MgrCommand() : CommandOp() {} -}; - -class MgrClient : public Dispatcher -{ -protected: - CephContext *cct; - MgrMap map; - Messenger *msgr; - - unique_ptr session; - - Mutex lock = {"MgrClient::lock"}; - - uint32_t stats_period = 0; - uint32_t stats_threshold = 0; - SafeTimer timer; - - CommandTable command_table; - - utime_t last_connect_attempt; - - Context *report_callback = nullptr; - Context *connect_retry_callback = nullptr; - - // If provided, use this to compose an MPGStats to send with - // our reports (hook for use by OSD) - std::function pgstats_cb; - - // for service registration and beacon - bool service_daemon = false; - bool daemon_dirty_status = false; - std::string service_name, daemon_name; - std::map daemon_metadata; - std::map daemon_status; - - void reconnect(); - void _send_open(); - -public: - MgrClient(CephContext *cct_, Messenger *msgr_); - - void set_messenger(Messenger *msgr_) { msgr = msgr_; } - - void init(); - void shutdown(); - - bool ms_dispatch(Message *m) override; - bool ms_handle_reset(Connection *con) override; - void ms_handle_remote_reset(Connection *con) override {} - bool ms_handle_refused(Connection *con) override; - - bool handle_mgr_map(MMgrMap *m); - bool handle_mgr_configure(MMgrConfigure *m); - bool handle_command_reply(MCommandReply *m); - - void send_report(); - void send_pgstats(); - - void set_pgstats_cb(std::function cb_) - { - Mutex::Locker l(lock); - pgstats_cb = cb_; - } - - int start_command(const vector& 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& metadata); - int service_daemon_update_status( - const std::map& status); -}; - -#endif -