|
24 | 24 | #include "trpc/common/trpc_version.h" |
25 | 25 | #include "trpc/config/trpc_conf.h" |
26 | 26 | #include "trpc/server/trpc_server.h" |
27 | | -#include "trpc/util/log/logging.h" |
28 | 27 | #include "trpc/util/http/common.h" |
| 28 | +#include "trpc/util/log/logging.h" |
29 | 29 |
|
30 | 30 | /// @mainpage tRPC-Cpp API |
31 | | -/// |
| 31 | +/// |
32 | 32 |
|
33 | 33 | /// @brief Primary namespace of tRPC-Cpp. |
34 | 34 | namespace trpc { |
@@ -112,17 +112,26 @@ class TrpcApp { |
112 | 112 | /// @return true: success; false: failed |
113 | 113 | bool StopService(const std::string& service_name, bool clean_conn = false); |
114 | 114 |
|
115 | | - /// @brief Register custom admin command |
| 115 | + /// @brief Deprecated: use "RegisterCmd(trpc::http::OperationType type, const std::string& url, |
| 116 | + /// const std::shared_ptr<trpc::AdminHandlerBase>& handler)" instead. |
116 | 117 | /// @param type operation type |
117 | 118 | /// @param url path |
118 | 119 | /// @param handler admin handler |
| 120 | + /// @note User need to manually manage the handler object, handler is not freed by framework |
| 121 | + [[deprecated("use shared_ptr interface for automatic object lifetime management")]] |
119 | 122 | void RegisterCmd(trpc::http::OperationType type, const std::string& url, trpc::AdminHandlerBase* handler); |
120 | 123 |
|
| 124 | + /// @brief Register custom admin command |
| 125 | + /// @param type operation type |
| 126 | + /// @param url path |
| 127 | + /// @param handler admin handler |
| 128 | + void RegisterCmd(trpc::http::OperationType type, const std::string& url, |
| 129 | + const std::shared_ptr<trpc::AdminHandlerBase>& handler); |
| 130 | + |
121 | 131 | /// @brief Register configuration update callback function |
122 | 132 | /// @param name configuration item |
123 | 133 | /// @param cb callback |
124 | | - void RegisterConfigUpdateNotifier(const std::string& name, |
125 | | - const std::function<void(const YAML::Node&)>& cb); |
| 134 | + void RegisterConfigUpdateNotifier(const std::string& name, const std::function<void(const YAML::Node&)>& cb); |
126 | 135 |
|
127 | 136 | protected: |
128 | 137 | // Parsing framework configuration files |
|
0 commit comments