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_
,
65 : PyModuleRunner(module_name_
, pClass_
, my_ts_
, clog_
)
68 int load(ActivePyModules
*py_modules
);
69 void notify(const std::string
¬ify_type
, const std::string
¬ify_id
);
70 void notify_clog(const LogEntry
&le
);
72 const std::vector
<ModuleCommand
> &get_commands() const
78 const cmdmap_t
&cmdmap
,
79 std::stringstream
*ds
,
80 std::stringstream
*ss
);
82 void set_health_checks(health_check_map_t
&& c
) {
83 health_checks
= std::move(c
);
85 void get_health_checks(health_check_map_t
*checks
);
87 void set_uri(const std::string
&str
)
92 std::string
get_uri() const
98 std::string
handle_pyerror();