|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
gRPC client for making RPC calls More...
#include <client.h>

Classes | |
| class | bidi_stream |
| Bidirectional streaming RPC handle. More... | |
| class | client_stream_writer |
| Writer for client streaming RPC. More... | |
| class | impl |
| class | server_stream_reader |
| Reader for server streaming RPC. More... | |
Public Member Functions | |
| grpc_client (const std::string &target, const grpc_channel_config &config={}) | |
| Construct gRPC client. | |
| ~grpc_client () | |
| Destructor. | |
| grpc_client (const grpc_client &)=delete | |
| grpc_client & | operator= (const grpc_client &)=delete |
| grpc_client (grpc_client &&) noexcept | |
| grpc_client & | operator= (grpc_client &&) noexcept |
| auto | connect () -> VoidResult |
| Connect to the server. | |
| auto | disconnect () -> void |
| Disconnect from the server. | |
| auto | is_connected () const -> bool |
| Check if connected. | |
| auto | wait_for_connected (std::chrono::milliseconds timeout) -> bool |
| Wait for connection to be ready. | |
| auto | target () const -> const std::string & |
| Get the target address. | |
| auto | call_raw (const std::string &method, const std::vector< uint8_t > &request, const call_options &options={}) -> Result< grpc_message > |
| Make a unary RPC call. | |
| auto | call_raw_async (const std::string &method, const std::vector< uint8_t > &request, std::function< void(Result< grpc_message >)> callback, const call_options &options={}) -> void |
| Make an async unary RPC call. | |
| auto | server_stream_raw (const std::string &method, const std::vector< uint8_t > &request, const call_options &options={}) -> Result< std::unique_ptr< server_stream_reader > > |
| Start a server streaming RPC call. | |
| auto | client_stream_raw (const std::string &method, const call_options &options={}) -> Result< std::unique_ptr< client_stream_writer > > |
| Start a client streaming RPC call. | |
| auto | bidi_stream_raw (const std::string &method, const call_options &options={}) -> Result< std::unique_ptr< bidi_stream > > |
| Start a bidirectional streaming RPC call. | |
Private Attributes | |
| std::unique_ptr< impl > | impl_ |
gRPC client for making RPC calls
This class provides a client interface for making gRPC calls over HTTP/2 transport. It supports unary and streaming RPC calls.
|
explicit |
Construct gRPC client.
| target | Target address (e.g., "localhost:50051") |
| config | Channel configuration |
Definition at line 1629 of file client.cpp.
References config.
|
default |
Destructor.
|
delete |
|
defaultnoexcept |
| auto kcenon::network::protocols::grpc::grpc_client::bidi_stream_raw | ( | const std::string & | method, |
| const call_options & | options = {} ) -> Result<std::unique_ptr<bidi_stream>> |
Start a bidirectional streaming RPC call.
| method | Full method name |
| options | Call options |
Definition at line 1695 of file client.cpp.
| auto kcenon::network::protocols::grpc::grpc_client::call_raw | ( | const std::string & | method, |
| const std::vector< uint8_t > & | request, | ||
| const call_options & | options = {} ) -> Result<grpc_message> |
Make a unary RPC call.
| method | Full method name (e.g., "/package.Service/Method") |
| request | Serialized request message |
| options | Call options |
Example:
Definition at line 1665 of file client.cpp.
| auto kcenon::network::protocols::grpc::grpc_client::call_raw_async | ( | const std::string & | method, |
| const std::vector< uint8_t > & | request, | ||
| std::function< void(Result< grpc_message >)> | callback, | ||
| const call_options & | options = {} ) -> void |
Make an async unary RPC call.
| method | Full method name |
| request | Serialized request message |
| callback | Callback with result |
| options | Call options |
Definition at line 1672 of file client.cpp.
| auto kcenon::network::protocols::grpc::grpc_client::client_stream_raw | ( | const std::string & | method, |
| const call_options & | options = {} ) -> Result<std::unique_ptr<client_stream_writer>> |
Start a client streaming RPC call.
| method | Full method name |
| options | Call options |
Definition at line 1688 of file client.cpp.
| auto kcenon::network::protocols::grpc::grpc_client::connect | ( | ) | -> VoidResult |
Connect to the server.
Definition at line 1640 of file client.cpp.
| auto kcenon::network::protocols::grpc::grpc_client::disconnect | ( | ) | -> void |
Disconnect from the server.
Definition at line 1645 of file client.cpp.
| auto kcenon::network::protocols::grpc::grpc_client::is_connected | ( | ) | const -> bool |
Check if connected.
Definition at line 1650 of file client.cpp.
References impl_, and kcenon::network::protocols::grpc::grpc_client::impl::is_connected().

|
delete |
|
defaultnoexcept |
| auto kcenon::network::protocols::grpc::grpc_client::server_stream_raw | ( | const std::string & | method, |
| const std::vector< uint8_t > & | request, | ||
| const call_options & | options = {} ) -> Result<std::unique_ptr<server_stream_reader>> |
Start a server streaming RPC call.
| method | Full method name |
| request | Serialized request message |
| options | Call options |
Definition at line 1680 of file client.cpp.
| auto kcenon::network::protocols::grpc::grpc_client::target | ( | ) | const -> const std::string& |
Get the target address.
Definition at line 1660 of file client.cpp.
References impl_, and kcenon::network::protocols::grpc::grpc_client::impl::target().

| auto kcenon::network::protocols::grpc::grpc_client::wait_for_connected | ( | std::chrono::milliseconds | timeout | ) | -> bool |
Wait for connection to be ready.
| timeout | Maximum time to wait |
Definition at line 1655 of file client.cpp.
|
private |
Definition at line 326 of file client.h.
Referenced by is_connected(), and target().