2 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
3 // vim: ts=8 sw=2 smarttab
5 * Ceph - scalable distributed file system
7 * Copyright (C) 2016 John Spray <john.spray@redhat.com>
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
18 // Python.h comes first because otherwise it clobbers ceph's assert
21 #include "common/cmdparse.h"
22 #include "common/LogEntry.h"
23 #include "common/Mutex.h"
24 #include "common/Thread.h"
25 #include "mon/health_check.h"
28 #include "PyModuleRunner.h"
35 class ActivePyModules;
38 * A Ceph CLI command description provided from a Python module
42 std::string cmdstring;
43 std::string helpstring;
45 ActivePyModule *handler;
48 class ActivePyModule : public PyModuleRunner
51 health_check_map_t health_checks;
53 std::vector<ModuleCommand> commands;
57 // Optional, URI exposed by plugins that implement serve()
61 ActivePyModule(const std::string &module_name_,
63 const SafeThreadState &my_ts_)
64 : PyModuleRunner(module_name_, pClass_, my_ts_)
67 int load(ActivePyModules *py_modules);
68 void notify(const std::string ¬ify_type, const std::string ¬ify_id);
69 void notify_clog(const LogEntry &le);
71 const std::vector<ModuleCommand> &get_commands() const
77 const cmdmap_t &cmdmap,
78 std::stringstream *ds,
79 std::stringstream *ss);
81 void set_health_checks(health_check_map_t&& c) {
82 health_checks = std::move(c);
84 void get_health_checks(health_check_map_t *checks);
86 void set_uri(const std::string &str)
91 std::string get_uri() const
97 std::string handle_pyerror();