A service that allows dynamic method registration.
More...
#include <service_registry.h>
|
| | generic_service (std::string service_name) |
| | Construct a generic service.
|
| |
| | ~generic_service () override |
| |
| | generic_service (const generic_service &)=delete |
| |
| generic_service & | operator= (const generic_service &)=delete |
| |
| | generic_service (generic_service &&) noexcept |
| |
| generic_service & | operator= (generic_service &&) noexcept |
| |
| auto | descriptor () const -> const service_descriptor &override |
| | Get the service descriptor.
|
| |
| auto | register_unary_method (const std::string &method_name, unary_handler handler, const std::string &input_type="", const std::string &output_type="") -> VoidResult |
| | Register a unary method handler.
|
| |
| auto | register_server_streaming_method (const std::string &method_name, server_streaming_handler handler, const std::string &input_type="", const std::string &output_type="") -> VoidResult |
| | Register a server streaming method handler.
|
| |
| auto | register_client_streaming_method (const std::string &method_name, client_streaming_handler handler, const std::string &input_type="", const std::string &output_type="") -> VoidResult |
| | Register a client streaming method handler.
|
| |
| auto | register_bidi_streaming_method (const std::string &method_name, bidi_streaming_handler handler, const std::string &input_type="", const std::string &output_type="") -> VoidResult |
| | Register a bidirectional streaming method handler.
|
| |
| auto | get_unary_handler (const std::string &method_name) const -> const unary_handler * |
| | Get unary handler for a method.
|
| |
| auto | get_server_streaming_handler (const std::string &method_name) const -> const server_streaming_handler * |
| | Get server streaming handler for a method.
|
| |
| auto | get_client_streaming_handler (const std::string &method_name) const -> const client_streaming_handler * |
| | Get client streaming handler for a method.
|
| |
| auto | get_bidi_streaming_handler (const std::string &method_name) const -> const bidi_streaming_handler * |
| | Get bidirectional streaming handler for a method.
|
| |
| virtual | ~service_base ()=default |
| |
| virtual auto | is_ready () const -> bool |
| | Check if this service is ready to handle requests.
|
| |
A service that allows dynamic method registration.
Use this class when you need to register methods at runtime without protobuf definitions. Supports all RPC types.
Example:
service.register_unary_method("Echo",
});
registry.register_service(&service);
A service that allows dynamic method registration.
Context for handling a single RPC request.
gRPC status with code, message, and optional details
static auto ok_status() -> grpc_status
Create OK status.
Definition at line 212 of file service_registry.h.
◆ generic_service() [1/3]
| kcenon::network::protocols::grpc::generic_service::generic_service |
( |
std::string | service_name | ) |
|
|
explicit |
Construct a generic service.
- Parameters
-
| service_name | Full service name (e.g., "package.ServiceName") |
Definition at line 256 of file service_registry.cpp.
257 :
impl_(std::make_unique<impl>(std::move(service_name)))
258{
259}
std::unique_ptr< impl > impl_
◆ ~generic_service()
| kcenon::network::protocols::grpc::generic_service::~generic_service |
( |
| ) |
|
|
overridedefault |
◆ generic_service() [2/3]
| kcenon::network::protocols::grpc::generic_service::generic_service |
( |
const generic_service & | | ) |
|
|
delete |
◆ generic_service() [3/3]
| kcenon::network::protocols::grpc::generic_service::generic_service |
( |
generic_service && | | ) |
|
|
defaultnoexcept |
◆ descriptor()
| auto kcenon::network::protocols::grpc::generic_service::descriptor |
( |
| ) |
const -> const service_descriptor& |
|
overridevirtual |
◆ get_bidi_streaming_handler()
| auto kcenon::network::protocols::grpc::generic_service::get_bidi_streaming_handler |
( |
const std::string & | method_name | ) |
const -> const bidi_streaming_handler* |
Get bidirectional streaming handler for a method.
- Parameters
-
- Returns
- Handler or nullptr
Definition at line 329 of file service_registry.cpp.
331{
333}
auto get_bidi_streaming_handler(const std::string &method_name) const -> const bidi_streaming_handler *
◆ get_client_streaming_handler()
| auto kcenon::network::protocols::grpc::generic_service::get_client_streaming_handler |
( |
const std::string & | method_name | ) |
const -> const client_streaming_handler* |
Get client streaming handler for a method.
- Parameters
-
- Returns
- Handler or nullptr
Definition at line 323 of file service_registry.cpp.
325{
327}
auto get_client_streaming_handler(const std::string &method_name) const -> const client_streaming_handler *
◆ get_server_streaming_handler()
| auto kcenon::network::protocols::grpc::generic_service::get_server_streaming_handler |
( |
const std::string & | method_name | ) |
const -> const server_streaming_handler* |
Get server streaming handler for a method.
- Parameters
-
- Returns
- Handler or nullptr
Definition at line 317 of file service_registry.cpp.
319{
321}
auto get_server_streaming_handler(const std::string &method_name) const -> const server_streaming_handler *
◆ get_unary_handler()
| auto kcenon::network::protocols::grpc::generic_service::get_unary_handler |
( |
const std::string & | method_name | ) |
const -> const unary_handler* |
Get unary handler for a method.
- Parameters
-
- Returns
- Handler or nullptr
Definition at line 311 of file service_registry.cpp.
313{
315}
auto get_unary_handler(const std::string &method_name) const -> const unary_handler *
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ register_bidi_streaming_method()
| auto kcenon::network::protocols::grpc::generic_service::register_bidi_streaming_method |
( |
const std::string & | method_name, |
|
|
bidi_streaming_handler | handler, |
|
|
const std::string & | input_type = "", |
|
|
const std::string & | output_type = "" ) -> VoidResult |
Register a bidirectional streaming method handler.
- Parameters
-
| method_name | Method name |
| handler | Handler function |
| input_type | Optional input type name for reflection |
| output_type | Optional output type name for reflection |
- Returns
- Success or error
Definition at line 301 of file service_registry.cpp.
306{
308 input_type, output_type);
309}
auto register_bidi_streaming_method(const std::string &method_name, bidi_streaming_handler handler, const std::string &input_type, const std::string &output_type) -> VoidResult
◆ register_client_streaming_method()
| auto kcenon::network::protocols::grpc::generic_service::register_client_streaming_method |
( |
const std::string & | method_name, |
|
|
client_streaming_handler | handler, |
|
|
const std::string & | input_type = "", |
|
|
const std::string & | output_type = "" ) -> VoidResult |
Register a client streaming method handler.
- Parameters
-
| method_name | Method name |
| handler | Handler function |
| input_type | Optional input type name for reflection |
| output_type | Optional output type name for reflection |
- Returns
- Success or error
Definition at line 291 of file service_registry.cpp.
296{
298 input_type, output_type);
299}
auto register_client_streaming_method(const std::string &method_name, client_streaming_handler handler, const std::string &input_type, const std::string &output_type) -> VoidResult
◆ register_server_streaming_method()
| auto kcenon::network::protocols::grpc::generic_service::register_server_streaming_method |
( |
const std::string & | method_name, |
|
|
server_streaming_handler | handler, |
|
|
const std::string & | input_type = "", |
|
|
const std::string & | output_type = "" ) -> VoidResult |
Register a server streaming method handler.
- Parameters
-
| method_name | Method name |
| handler | Handler function |
| input_type | Optional input type name for reflection |
| output_type | Optional output type name for reflection |
- Returns
- Success or error
Definition at line 281 of file service_registry.cpp.
286{
288 input_type, output_type);
289}
auto register_server_streaming_method(const std::string &method_name, server_streaming_handler handler, const std::string &input_type, const std::string &output_type) -> VoidResult
◆ register_unary_method()
| auto kcenon::network::protocols::grpc::generic_service::register_unary_method |
( |
const std::string & | method_name, |
|
|
unary_handler | handler, |
|
|
const std::string & | input_type = "", |
|
|
const std::string & | output_type = "" ) -> VoidResult |
Register a unary method handler.
- Parameters
-
| method_name | Method name (without service prefix) |
| handler | Handler function |
| input_type | Optional input type name for reflection |
| output_type | Optional output type name for reflection |
- Returns
- Success or error
Definition at line 271 of file service_registry.cpp.
276{
278 input_type, output_type);
279}
auto register_unary_method(const std::string &method_name, unary_handler handler, const std::string &input_type, const std::string &output_type) -> VoidResult
◆ impl_
| std::unique_ptr<impl> kcenon::network::protocols::grpc::generic_service::impl_ |
|
private |
The documentation for this class was generated from the following files: