|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
Central registry for managing gRPC services. More...
#include <service_registry.h>

Classes | |
| class | impl |
Public Member Functions | |
| service_registry (const registry_config &config={}) | |
| Construct service registry. | |
| ~service_registry () | |
| service_registry (const service_registry &)=delete | |
| service_registry & | operator= (const service_registry &)=delete |
| service_registry (service_registry &&) noexcept | |
| service_registry & | operator= (service_registry &&) noexcept |
| auto | register_service (service_base *service) -> VoidResult |
| Register a service. | |
| auto | unregister_service (const std::string &service_name) -> VoidResult |
| Unregister a service. | |
| auto | find_service (const std::string &service_name) const -> service_base * |
| Find a service by name. | |
| auto | services () const -> std::vector< service_base * > |
| Get all registered services. | |
| auto | service_names () const -> std::vector< std::string > |
| Get list of all service names. | |
| auto | find_method (const std::string &full_method_path) const -> std::optional< std::pair< service_base *, const method_descriptor * > > |
| Find a method by full path. | |
| auto | is_reflection_enabled () const -> bool |
| Check if reflection is enabled. | |
| auto | configure_server (grpc_server &server) -> VoidResult |
| Configure a gRPC server with registered services. | |
| auto | set_service_health (const std::string &service_name, bool serving) -> VoidResult |
| Set health status for a service. | |
| auto | get_service_health (const std::string &service_name) const -> bool |
| Get health status for a service. | |
Private Attributes | |
| std::unique_ptr< impl > | impl_ |
Central registry for managing gRPC services.
The service registry manages all registered services and provides:
Example:
Definition at line 445 of file service_registry.h.
|
explicit |
Construct service registry.
| config | Registry configuration |
Definition at line 716 of file service_registry.cpp.
References config.
|
default |
|
delete |
|
defaultnoexcept |
| auto kcenon::network::protocols::grpc::service_registry::configure_server | ( | grpc_server & | server | ) | -> VoidResult |
Configure a gRPC server with registered services.
| server | Server to configure |
Definition at line 763 of file service_registry.cpp.
| auto kcenon::network::protocols::grpc::service_registry::find_method | ( | const std::string & | full_method_path | ) | const -> std::optional<std::pair<service_base*, const method_descriptor*>> |
Find a method by full path.
| full_method_path | Full method path (e.g., "/package.Service/Method") |
Definition at line 752 of file service_registry.cpp.
| auto kcenon::network::protocols::grpc::service_registry::find_service | ( | const std::string & | service_name | ) | const -> service_base* |
Find a service by name.
| service_name | Full service name |
Definition at line 736 of file service_registry.cpp.
| auto kcenon::network::protocols::grpc::service_registry::get_service_health | ( | const std::string & | service_name | ) | const -> bool |
Get health status for a service.
| service_name | Service name (empty for server-wide status) |
Definition at line 788 of file service_registry.cpp.
| auto kcenon::network::protocols::grpc::service_registry::is_reflection_enabled | ( | ) | const -> bool |
Check if reflection is enabled.
Definition at line 758 of file service_registry.cpp.
References impl_, and kcenon::network::protocols::grpc::service_registry::impl::is_reflection_enabled().

|
delete |
|
defaultnoexcept |
| auto kcenon::network::protocols::grpc::service_registry::register_service | ( | service_base * | service | ) | -> VoidResult |
Register a service.
| service | Service to register (registry does not take ownership) |
Definition at line 726 of file service_registry.cpp.
| auto kcenon::network::protocols::grpc::service_registry::service_names | ( | ) | const -> std::vector<std::string> |
Get list of all service names.
Definition at line 747 of file service_registry.cpp.
References impl_, and kcenon::network::protocols::grpc::service_registry::impl::service_names().

| auto kcenon::network::protocols::grpc::service_registry::services | ( | ) | const -> std::vector<service_base*> |
Get all registered services.
Definition at line 742 of file service_registry.cpp.
References impl_, and kcenon::network::protocols::grpc::service_registry::impl::services().

| auto kcenon::network::protocols::grpc::service_registry::set_service_health | ( | const std::string & | service_name, |
| bool | serving ) -> VoidResult |
Set health status for a service.
| service_name | Service name (empty for server-wide status) |
| serving | True if the service is serving |
Definition at line 782 of file service_registry.cpp.
References kcenon::network::protocols::grpc::serving.
| auto kcenon::network::protocols::grpc::service_registry::unregister_service | ( | const std::string & | service_name | ) | -> VoidResult |
Unregister a service.
| service_name | Full service name |
Definition at line 731 of file service_registry.cpp.
|
private |
Definition at line 552 of file service_registry.h.
Referenced by is_reflection_enabled(), service_names(), and services().